cakephp

Storing sort order for items held in an HABTM association - CakePHP

In an ActiveRecord (CakePHP flavored) setup I have a HasAndBelongsToMany association setup on Videos and Bins: A Bin can store n references to Videos, and Videos can belong to n Bins. I need to be able to manually set and store the display order of the Videos within a particular Bin (so the client can have his Videos in a particular ord...

Dealing with Alias URLs in CakePHP

I am rewriting our company website in cakephp, and need to find a way to do the following: A user enters our site by using one of the promotional alias URLS that has been pregenerated for a specific media advert ( magazine, web promotion etc ) The URL is checked against a database of alias URLs, and if an alias exists, then a specific ...

Custom 404 script in Cake PHP

This question is slightly related to my old post http://stackoverflow.com/questions/940326/dealing-with-alias-urls-in-cakephp/ After much thought, I am exploring the option of having a custom 404 script in my Cake App, that is reached when a URL does not map to any controllers/actions. This script would check $this->here and look it up ...

CakePHP ACL Setup Help

I have a database setup like this (I know it isnt the best setup but its out of my power to change it :-( Basically there are 3 levels of users - Admin - Managers - Staff Few notes: -Each member of staff belongs to department -If the Staffs logon_code appears in the manager table they are a Manager, otherwise they are a member of staff...

CakePHP: Is it possible to associate a model with a database view instead of a table?

I was wondering if it was possible to create a view in a database then be able to link a Model to it? ...

CakePHP Media view download directly from a string

I have a CakePHP controller action where I would like to let the user download an HTML page for publishing through our internal CMS. I'm thinking that the notion of a Media View is what I want, except that they seem to require a filename and path. I already have the HTML content stored in a string and if possible I would like to be able ...

CakePhp multiple i18n insert

Hi, i need to create a form in cakephp so that i can insert content in multiple language at the same time let's say eng and esp the form will be like: Insert english title _____________ Insert spanish title _____________ i'm using i18n for the translated fields but the documentation doesn't say much, can anyone give me some advice?...

cakephp - Creating fixtures, how to handle foreign keys?

Hey all - I'm trying to create some fixture data for my unit tests in CakePHP (via SimpleTest) and I have no idea how to handle my foreign key relationships. Here's a sample of the fixture code: <?php class SpecialtyFixture extends CakeTestFixture { var $name = "Specialty"; var $import = "Specialty"; var $records = array( ...

generate list with habtm relationship - CakePHP

Hi. I want to generate a list (dropdown) with habtm relationship, for example i have a table called "users" another called "vehicles" and "users_vehicles". What i want is to get vehicles assigned to "x" user and put it in a dropdown, how i can achieve this? class User extends AppModel { var $hasAndBelongsToMany = array('Vehicle'...

What is better CakePHP or pure PHP for a huge Project?

I just know pure PHP, never worked with a framework before, but my boss wants me to create our next project, which will be a lot bigger than everything we did before (means bigger than a page that needs only 5 scripts to work, more like 100 or something like that). But I'm not sure if I can realise it with pure PHP, now I heard that Cak...

fixing cakephp .htaccess/mod_rewrite for shared hosting setups

I'm trying to install cakePHP on a shared hosting setup. After extracting the files to a location like ~/public_html/dev/cake and visiting the appropriate URL (in this case http://hostname/~username/dev/cake/), I receive a 404 error: Not Found The requested URL /usr/home/username/public_html/dev/cake/app/webroot/ was not found on thi...

How to send mail via PHP and/or CakePHP on a Fasthosts account.

I've had no need to send mails on my 2 sites hosted at the UK Fasthosts provider. But since I've added some email features to one of my sites I've tried to send mail via the Email Component of CakePHP and it doesn't leave the server, even if the send returns success. I've tried with plain mail() function and with the smtp option and got...

Call log() from Model in CakePHP

How can I call the log() function inside the model beforeSave() function? All three variants I used didn't work: function beforeSave() { #... Debugger::log($y.' '.$ty); log('test'); $this->log('testmodel'); } ...

jquery sortable in cakephp, stuck at ajax part

Hi, I used to use scriptaculous in all my cakephp projects because of its easy helpers. In time, i got more and more into jquery and now I want to replace my current scriptaculous script with jquery. Until now > everything is good. Except jquery sortable. Jquery sortable runs, but the ajax call after isn't working right. Now my program...

Using mysql_real_escape_string and htmlspecialchars in cakephp?

Hello, I am using FCKEditor with CakePHP and when I save data sent from the editor I want to run the htmlspecialchars() and mysql_real_escape_string() functions on the data to clean it before I store it in my database. The problem is I am not really sure where to do this within the CakePHP framework. I tried in the controller like thi...

Auth Component not working as expected in cakephp

Hi, I am trying to build the login registration page for my website, I am facing problems with he Auth Component, function beforeFilter() { $this->Auth->loginAction = array('controller'=>'users','action'=>'login'); $this->Auth->loginRedirect = array('controller'=>'users','action'=>'landing'); $this->Auth->logoutRedirect = array('cont...

CakePHP password field is empty

Hi, I am implementing an authentication component, This is my registration page create('User',array('action' => 'login')); echo $form->input('primary_email',array('size'=> 32)); echo $form->input('password',array('label' => 'Password')); echo $form->input('remember_me',array('label' => 'Remember Me','type'=>'checkbox','ch...

HABTM association on HABTM join table in CakePHP

I'm trying to save data with following structure: As you can see, there is HABTM association between users and experiences table. And another HABTM between *experiences_users* and tags. I created following form: <?php echo $form->create('Experience', array('action' => 'addClassic'));?> <?php echo $form->input('Experience.date...

Looping inside a loop

I'm trying to display the associated forums inside a category during a loop in /categories/index Array ( [0] => Array ( [Category] => Array ( [id] => 1 [name] => General [status] => 1 [order] => 1 ) ...

Multiple controllers in CakePHP

Hi, I m new to cakephp... I m developing an app using CakePhp and Mysql. In Cakephp i am having two tables one is Form (id ,name,created , modified) and attributes (id, Attribute-name ,form_id ,value) I kept everything in only one controller that is in forms controller.Within this formsctrller , i m having actions...