cakephp-1.3

custom controller name in CakePHP

Hello guys I am developing an application in cakephp, I have to provide a user page for each user in the site like www.example.com/username, username will changes for each user, when a visitor comes to this url he gets details of the user with that particular username, but in cake username tries to get the controller with that name, How...

CakePHP 1.3 Plugin Shortcut Route

Hi, I searched a lot around the web but I couldn't find any specific sollution to this. In CakePHP 1.3, different from 1.2, if you had a controller inside a plugin, and both had the same name, you could access through "<plugin>/<action>", and it would call the 'default' controller. But in 1.3, according to this: http://cakeqs.org/eng/q...

CakePHP Missing Controller - but it exists

I recently downloaded cakephp-1.3.4. I set it up on my web server. I followed the advanced installation settings. My folder structure is as follows. /common/ cakephp/ app/ etc... /htdoc/ The /htdoc folder is the webroot; cakephp resides in the common folder. I have configured the paths in index.php to point to this folder...

The best way to implement REST in CakePHP 1.3?

Does anyone know of any tutorials that explain clearly how to implement simple REST functionality with authorization. I've seen a few plugins and got also got some basic REST functionality working but there seems no clear guidelines about how to build a secure REST service in Cake. Any help appreciated. ...

How do I write a subquery in cakephp

Hello everyone, I am totally lost in implementing the following sql using cakephp ORM SELECT * FROM users WHERE users.id NOT IN ( SELECT potentials.user_id FROM potentials ) I have tried this but it is not working at all $this->User->find('all', array( 'contain' => array( 'City' => array( ...

CakePHP - Custom hasOne Object Association - Using a Join Table instead of in-table foreign keys?

In CakePHP, I'm trying to build a $hasOne relationship, but I can't add a foreign key to the tables (for legacy reasons). Is there any way I can create a join table (object1_object2) and link them together like this? I want to leverage Cake's powerful object relationship functionality, so if there's a way I can make this custom associa...

In CakePHP, why would $this->params['form'] be empty if I've just posted a form?

Using CakePHP 1.3, I post a form which correctly fills in $this->data. According to the docs, it seems like $this->params['form'] should be populated with some information as well, but it's simply an empty array. Is there a particular reason for that? The form is built using the Form Helper, as follows... Some relevant code: $defaul...

Pass data from javascript to PHP in cakephp

Hello I have a select element which has a few options. I am able to get the selected option when an onChange event is fired. Now I need to pass that option text to php, either with pageload or ajax. echo $form->select('data_source_select',$dataSourceOptions,null,array('escape'=>false, 'empty'=>'Select One','onChange'=>'getData(this)'));...

get data from database using Ajax in cakePHP

Hello I need to retrieve data from database via an ajax call. I am unable to find any good resources for this. Any help would be great. Thanks ...

Can I use dynamically created form fields with the Security Component in CakePHP 1.3?

Using CakePHP 1.3, I have a (working) form that has dynamically created form fields (via Javascript). Everything works great, multiple models are saved via saveAll(), and it's just beautiful. But, I get black-holed to a 404 whenever I enable the Security component (hoping to get some of the auto-magic CSRF protection). I understand t...

Display selected option after form post

Hello I have a html select which has an onchange event. And whenever a user selects an option, data related to that option would be retreived from the database. But the select is set to its original or default option as a post would occur. How do I set the select to the user selected option?? I am using cakePHP for this, but I am pretty...

Can we have Multiple Admin Routing in Cakephp ?

I want multiple admin routing.. One for Admin another for CLients.. is this possible. if not whats the best way to get around to this ? thanks a lot. ...

index.ctp not recognized in cakephp

I have created index.ctp under views/controller_name/ folder, but the Missing view error is still appearing? any suggestions? ...

CakePHP 1.3.4 $belongsTo problem incase of Relationship table

I have a table called user_relationship. which has two foreign keys refering back to the User table to map that they are friends. CREATE TABLE `user_relationships` ( `id` int(11) unsigned NOT NULL auto_increment, `status` varchar(255) default 'pending', `time` datetime default NULL, `user_id` int(11) unsigned NOT NULL, `frien...

In cakephp, how can I set conditions for a model that is not associated with the one I am paginating but which is associated to one that is?

I am paginating ($this->Customer->paginate()) on the 'Customer' model. The customer model is associated to the 'Contact' model which in turn is associated to the 'ContactAddress' model. So: Customer hasMany Contact Contact belongsTo ContactAddress Now I want to paginate customers in the 'Customers->index()' using a search query let'...

Cakephp how to reduce number of rows displayed with the Multiple Select

I have a HABTM relation and when i use the following code. the Multiple Select is pretty long in size. i wanna know how to reduce the size. <label for="checkbox">Cuisines:</label> <?php echo $this->Form->input('Cuisine', array('label' => false, 'div'=> false, 'class' => 'short')); ?> I am not finding any option to reduce thi...

cakePHP: Overload Sanitize

In the recent cakePHP 1.3.4 version I discovered that Sanitize::html returns double encoded html entities - because of the newly added fourth parameter of htmlentities 'double_encode'. Here is a corresponding ticket on cakePHP: http://cakephp.lighthouseapp.com/projects/42648/tickets/1152-sanitizehtml-needs-double_encode-parameter-in-htm...

CakePHP 1.3 RSS Helper

I went through the Book and I've copied code from the section http://book.cakephp.org/view/1460/RSS but can't get this to work: I end up with a zero byte file (index.rss) being offered for download by my broswer, instead of xml output. I have narrowed the error down to this piece of code (in app/views/posts/rss/index.ctp): $postLink = ...

Submitting current timestamp in cakephp

What is the method to submit a current timestamp directly on an insert or an update. If I were running regular sql, I would use the function NOW() for the specific sql field on submission. How would I do that with cakephp. $this->Model->save($this->data) ...

Cakephp Dynamically add Drop down menus for Time

I have a form which includes adding operting time for a restaurant. operation_hours(weekday, open_time, close_time, restaurant_id) i use this in the form <div class="operation_hours"> <?php echo $this->Form->dateTime('RestaurantOperationHour.open_time', false, '12', null, array('interval' => 15, 'value' => '10:00:00')); ?> <?php echo...