cakephp

Cakephp - how to can error pages have its own layouts ?

i wanna have a different layout for the page not found 404 page. how can i set a differet layout for that page ? ...

CakePHP Date Validation using date array format

Greetings, In my view I have a date input, set like so: echo $form->input('cc_expdate', array('label' => __('exp. date', true), 'type' => 'date', 'dateFormat' => 'MY', 'default' => date('Y'), 'minYear' => date('Y'), 'maxYear' => date('Y', strtotime("+10 years")), 'orderYear' => 'asc', 'separator' => ' ', 'm...

Cakephp Auth: $this->Auth->loginError message

I am using Auth Component. I am setting $this->Auth->loginError in the beforeFilter. But i have another posibility. If the user entered username and password is correct but User.status = 'pending' how can i can show a different message. i am using $this->Auth->userScope to set that. but how to show different $this->Auth->loginError for t...

How to request data from different php page without a redirect that works with Ajax?

So I have this one CakePHP web application that I'm trying to refactor. There is a large portion of code that usually works like this: E.g. "Flag": User clicks flag button Redirect the user to the flag action Flag action flags post Redirect user to post that was just flagged. I am also trying to enhance it with JavaScript like so: Use...

Is it better to import controllers or models in CakePHP?

In a CakePHP application, is it better to import Controllers that have access to models or the Models themselves? ...

How to use Js->submit() in CakePHP?

Im trying to create a simple Ajax form for a message board in a CakePHP application, but I can't for the life of me figure out how to properly use the Js->submit() function to submit a form via Ajax. Heres the form code within my view: <?php echo $this->Form->create('Message',array( 'type' => 'post', 'action' => 'add', 'onSubm...

Find condition in cakePHP with Containable behavior

Hi, I have 2 models, User and Evolution. User has many Evolution, Evolution belongs to User. I have 10 000 users and I want to do a condition that give me 500 users that DON'T have today's date in the Evolution table. Originally, I was taking every one in the USER table and then I was looking if they had their row in Evolution like: ...

CakePHP- I want to display the image with specifec height n width.

Hi all, I am creating a cakephp application in which im uploading a image. But on some functionality of my app i want to display the image in specific height n width, without compromissing in image quality. So please suggest me if ther is any way to do this. ...

Cakephp: How to read User Data in Session ?

I wanna gather the latest information of a user from the User Model and store it in the session. so i am doing this // Before Render function beforeRender() { if($this->Session->check('Auth.User')) { $this->User->recursive = -1; $currentUser = $this->User->read(null, $this->Session->read('Auth.User.id')); ...

CakePHP: Doing Complex Find

In my application i have a threaded commenting system which i call status messages. i have a few models as follows users(id, name......) status_messages(id, message,......, user_id) status_replies(id, message,......, status_message_id, user_id) is this the right way of writing a commenting system ? A user can set status messages and...

I use Comments plugin with Articles plugin and cant delete comment

I use Articles Plugins and Comments Plugins. Articles use Comments Plugins .Comments plugin have CommentableBehavior to bindModel Articles please watch code: http://gist.github.com/620472 This is error when i use $this->Comment->delete($id);. I cant delete comment. Warning (512): SQL Error: 1052: Column 'id' in where clause is ambig...

CakePHP: Autocomplete for multiple tags in one textfield

Hi, I want to use the autocomplete component for cakephp but instead of just autocompleting one value in a textfield i want it to work like SOF tags. i.e. one tag, 2nd tag, ... Does anyone know if there is an option for this using this component? thanks, Jonesy ...

DB for Commenting System

i wanna create a 2 level status message system. Which is the best way to create a tables ? Scope: User sets a Status Message Users Reply to the status message this is a picture showing it Tables i have created users (id, name .... ) status_messages (id, message, time, user_id) status_message_replies (id, message, time, status_me...

Cakephp model associastion

I have thee following simple model: Item belongsTo CatalogItem CatalogItem hasMany Item, and belongsTo Section Section hasMany CatalogItem I'm trying to get counts of items, grouped by catalogitem, for a certain section- the equivalent of: SELECT catalogitem.id, count(*) FROM section LEFT JOIN catalogitem ON section.id=catalogitem.sec...

cakephp 1.3: displaying row id instead of row value, please help

Hello guys, I am using cakephp 1.3, I am having a small issue,please help I have 2 tables in my database Profiles and qualifications, Profiles belongs to qualifications and qualifications has many profiles. qualification display_field is set to 'qualification', I used cake bake all for creating CRUD, when I try to add profile I get the...

Cakeph Routing help

I have a users module and few actions like wall, dishes, restaurants, photos. i wanna set up a routing like something like this site.com/users/{userId or Username}/wall => should route to wall() action site.com/users/{userId or Username}/dishes => should route to dishes() action site.com/users/{userId or Username}/restaurants => sho...

file upload in cakephp

Hello How can I upload a file using cakephp ? is there any framework support for file uploading or should I write my own code for this ? Thank you ...

cakephp SQL error at $this->User->saveField()

Hey guys. When I try to update a user, let's say his account balance $this->User->id = $validUserId; $this->User->saveField('balance', 100); I get this error SQL Error: 1054: Unknown column 'User.group_id' in 'field list' with this automatically generated query druring the save process SELECT `User`.`group_id` FROM `users` AS `Us...

Can jQuery plugins be used in cakePHP??

Hello I am not able to understand how to use jQuery plug-ins in cakePHP. I have one plug-in by the name "countdown". It has 2 js files, one html, one css file and a few images. If I were using regular javascript file, I'd have to give a name to my file and call it in the view or in default.ctp using the "$html->script('path/to/file')" fu...

How do you capture the SQL queries running in a CakePHP page?

I have a production CakePHP site where I need to troubleshoot a slow SQL query. I want access to that great table CakePHP creates with the actual SQL query, execution time, etc, but I can't set the DEBUG level to 3 on a production site. I imagine this is a simple but I just can't seem to figure out how I can get this information for a s...