cakephp

HABTM relationship on the same table in CakePHP

Hi, I was modeling a social networking style website where people would be able to have other people on their contacts list, i wanted to model this relationship as a HABTM relation on the Same table i.e User, is this a good idea? or is there a better way to do it? ...

Query to be used in the conditions, when space in between the value

Hi! I am using JQuery and CakePHP for my application. I have a table Attributes(id,form_id,label,type) In this table, I have an entry like 1 1 First name Text 2 1 Lastname Text I have written a CakePhp query to retrieve the id given the form_id and the label $attri = $this->Attribute->find('all', array( 'fields'=> array('Attri...

How to keep String in the Form input in cakePhp

Hi, I am using Cakephp and JQuery in my application. I am having a Form generated in cakePhp.I got the posted values of this form using echo http_build_query($_POST); If my form has any field with name as Firstname it is posted as correctly, But when i have any field in the form with the name as Last name (i.e. with spaces in be...

use of sessions in cakephp

Hi, can anyone give me an example on how to create Sessions and write data to it. I've seen syntax on how to write data to a session using write command. But how to create a session and retrieve the values in it. In my application, I have two data, form_id and user_id that needs to be used in all the page requests. So how do I save it...

Retreiving values from Jquery to a controller in cakephp

hai guys am new to this cakephp stuff and is having problem using cakephp with jquery... my problem is that am not able to get the values posted from jquery to a controller in php... my controller file is simple and is given below... users_controller.php <?php class UsersController extends AppController { var $name = "Users...

call controller function from views in cake php

I want to call a controller function from a view. Is that possible in Cake PHP? ...

Any tips for switching from CakePHP to Ruby on Rails?

I've been wanting to make the switch from PHP. Anyone care to highlight the similar classes or the key differences between CakePHP and Ruby on Rails? Thank you! ...

view in thumbnail

I want to view all files in thumbnail view using cakephp.how? ...

How do you specify an HTTP status code in Cakephp?

In my controller, I check a condition to see if the user is allowed to do something. If the check fails, I want to send a 403 back to the browser. How do I do that in Cakephp? ...

connecting to oracle remote server with CakePHP

Hi, First I am sorry if I posted at the wrong place. Now onto the problem: I am developing a web app with CakePHP with Oracle backend on Windows box, the development was initially done in CodeIgniter, and recently we decided to migrate to CakePHP. The Oracle server is located at the different subnet. I am able to connect Cake to the ...

Will the save method in a Cakephp model class choose between creating and updating a record?

Basically, I want to achieve the same thing as ON DUPLICATE KEY in MySQL. Here's a contrived example: $rec = array('Foo' => array( 'id' => 999, // Assume there isn't already a record with this id 'website' => 'google' )); $this->Foo->save($rec); // save with different 'website' value $rec['Foo']['website'] = 'stackoverflow'; $th...

Variable naming conventions in CakePHP

What is the best way to name variables which contain multiple words? After going through lots of projects available in the CakePHP forge, I have noticed people use either camelCase, underscores or camelCase for variables and underscores for data sent to the view. An example of the last one would be: $activeSites = $this->Site->find('al...

Scroll issues with Script.aculo.us / CakePHP autocomplete result list

Using the Ajax helper for CakePHP (currently 1.2.3.8166) to provide an $ajax->autoComplete list of results, and giving a result list back as the rendered view, if you use the mouse (and even the mouse wheel) to scroll results, all is well. Using the arrow keys, on the other hand, has the nasty effect of awkwardly scrolling the view: if I...

Does CakePHP handle FKs on the code level or should I be adding FKs to my db too?

Will I suffer consequences later if I add FKs with ON DELETE CASCADE and such? If not, what naming convention should I be using for FKs within MySQL for CakePHP? ...

Is there any IDE that has code-hinting for CakePHP or any code-hinting package that can be installed somehow?

Question says it all... ...

Are MySQL ENUMS intended for use with CakePHP or should I avoid them?

Thing is, I don't see these ENUMs producing pull-down menus in CakePHP scaffolding, so I'm thinking CakePHP might advise against it, but I can't find any documentation on the matter. Anyone know whether or not to use ENUMs? ...

post habtm postlover : how to order posts by number of postlovers?

Hi guys...please help me, i'm really struggling with this... Authors can write post, and authors can love other authors' posts... So posts belong to author (when authors write them), but posts habtm authors (when authors love them). For example i'd like to get posts ordered by number of postlovers and created in the last 24 hours. He...

Running CakePHP Shells on Background

Is it possible for CakePHP to execute a cakephp shell task on background for i.e running long reports. I would also want to update the current status back to the user via updating a table during the report generation and querying using Ajax. ...

Cake PHP autmagic forms and multiple tables

I have a form with the following fields: firstName lastName emailAddress followed by (up to) ten name/email fields, like so friendName-1 friendEmail-1 friendName-2 friendEmail-2 ... etc. The firstName, lastName & emailAddress fields will be saved into a 'referrals' table, but 10 name/email pairs will go into a 'friends' table, c...

how pass value from helper to controller

I have a helper class.I have a view and controller.How can i pass a value from helper to the view? ok Plz tell me is it possible to get he same value from the controller? bcoz i have a div in my view while closing the div i need to call controller there i need the helper value Advance Thanks. ...