cakephp

Cakephp call a function from another controller returns "Warning (512): SQL Error: 1064"

Hi, I'm sure this issue can be solved rapidly, but I don't find any answer on the web, so here I am. I want to call a function from another controller, but CakePHP does not recognize it as a function but as a query, returning a warning: Warning (512): SQL Error: 1064: You have an error in your SQL syntax; check the manual that correspo...

Custom CakePHP order by clause for jQuery autocomplete

I have a database of locations the user can select from by typing and autocompletion. In my CakePHP controller, I do this: $locations = $this->Location->find('all', array( 'conditions' => array('Location.name like' => '%'.$term.'%'), 'fields' => array('Location.id', 'Location.name', 'Region.name'), 'order' =>...

What's difference between using cakephp console and using IDE to build the application?

Hi guys I am a cakephp newbie and I would like to know what method you guys use to build your cakephp project. The tutorial I read is using cakephp console to bake application but the book I have use IDE to build the application. It seems console is more convenience because it can generate different projects name...Using IDE would requi...

CakePHP and existing codebase living peacefully side-by-side

I've got two legacy codebases that I would like to have living side by side. One is Cake, one is handwritten PHP. I would like both to be located at www.example.com. I'd like the handwritten PHP to serve any requests in the root directory, but anything else I'd like to go to the cake codebase. I cannot simply put cake in a subdir, be...

HasMany Relationship and ID from other Model in CakePHP

I am wondering whether it is possible to create a hasMany Relationship in a Model which makes use of the ID of the logged in user. Example: One tip has many votings (from different users). This is easy: public $hasMany = array( 'TipVoting' => array( 'className' => 'TipVoting', 'foreignKey' => 'tip_id', 'depen...

cakephp 1.1 with php 5.3

I have just upgraded from php 5.1 to 5.3 and had previously been using cakephp 1.1 on my server. Since the upgrade (or possibly earlier, I can't be sure), I'm getting the following errors. Can anyone shed some light: Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/dispat...

Using email instead of username in CakePHP's Auth Component

CakePHP's Auth component requires the username field to be present in order to convert the password field into a hash upon save. Apparently, even if I put this in the beforeFilter() - "$this->Auth->fields = array('username' => 'email', 'password' => 'password');" - it doesn't encrypt the password before inserting it into the database. S...

Cakephp Route Top Level Request

Hi - I have a 1.2 app that I'm updating to 1.3. I need to send all top level requests like /foo to a controller action (/sites/view/$1) if they are not a valid controller. So in my 1.2 app I had a route like this (incredibly ugly I know): Router::connect('(?!admin|billings|carriers|clips|cliptypes|contacts|domains|faqs|leadcomments|...

CakePHP: Controller Response for Ajax Request is wrong

Hi, I'm using jQuery to make an AJAX request to some controller action. This request is activated from a button in the view of the edit action in the same controller. My problem: The Ajax Request is returning all the code of the edit view (with all the forms and inputs) instead of the expected number. If I put the same ajax button in ...

CakePHP - Calling a model function in a HABTM

I have two tables, Pages and Posts that are in HABTM and are joined using pages_posts join table. My Page model along with the HABTM definition contains a function.. class Page extends AppModel { var $name = "Page"; ...... ...... function callthis() { return $this->find('all');; } } From my Posts controller, I'...

Is it possible unique user login in cake php

i want to know the code for at a time single user login on any browser or computer of a user. Can u help me. Thanxs, ...

How to install cakephp on localhost?

I wanna to know how to install cakephp on localhost? Please explain me. ...

CakePhp, getting total of many rows in a Containable.

Hi, I have a query using the Containable behaviors in cakephp thats looks like this : $x = $this->find('first',array('contain'=>array( 'User' => array( 'SelectionsTeam' => array('conditions' => $conditionTeamSelection, 'Team' => array( 'fields' => array('name','city','id'), ...

Javascript file inclusion 406 error in CakePHP

Hi, I have several js files under webroot http://www.in-culture.info/app/webroot/js/ All the files are ok Eg http://www.in-culture.info/app/webroot/js/lightbox.js Except this http://www.in-culture.info/app/webroot/js/jquery.cookie.js It's throwing 406 Not acceptable error. Help please. ...

CakePHP Form Validation Error Placement

Is there any way to change the placement of form validation messages in CakePHP? For instance, I have the following: In the view: echo $form->input('fname', array('before' => '<li>', 'label' => 'First Name', 'after' => '</li>')); In the controller: 'fname' => array('rule' => 'notEmpty', 'message' => 'Please enter your first name.'),...

Implementing ondelete restrict association in CakePHP

Hi I have Event belongsTo Venue association. When a user tries to delete a venue, I don't want it to happen when one or more event is associated with it. What's the most automagic way to do it? ...

Pickup table display in CakePHP

Hi, I have Venues HasMany Events association. In the side bar, I want to list only Venues with at least one event associated. What's the find condition? ...

Order data using values stored in another table

I've been using cakephp for a while, but have not learned all the ins and outs yet so I may be missing something simple. Or the problem may lie with my database structure. Either way, if anyone has any idea of what I'm doing wrong, please share. Is there a way to order the data returned by cakephp's find using values stored in another t...

CakePHP permissions management plugin

I'm specially looking for a good UI to manage permissions of users/groups based on CakePHP's auth and acl components. is anyone knows a good plugin (or good working code) to manage users and their permissions? ...

cakephp saveAll not working at all

Hi, so I have a Tarif, which hasMany Price (each for different currency - doesn't really matter) the view (deleted irrelevant parts) <?php echo $this->Form->create('Tarif'); echo $this->Form->input("Price.0.price"); echo $this->Form->input("Price.0.currency"); echo $this->Form->input("Price.0.sms_format"); echo $this->Form->inp...