cakephp

CakePHP: How can I change this find call to include all records that do not exist in the associated table?

I have a few tables with the following relationships: Company hasMany Jobs, Employees, and Trucks, Users I've got all my foreign keys set up properly, along with the tables' Models, Controllers, and Views. Originally, the Jobs table had a boolean field called "assigned". The following find operation (from the JobsController) successf...

Cake returned the time consumed in data lookup in JQuery Alert Box

Hi all, When I was doing some self-learning on JQuery Ajax in Cakephp, I found out some strange behaviour in the JQuery Alert Box. Here are a few lines of code of the JQuery Ajax I used: $(document).ready(function(){ $(document).change(function(){ var usr = $("#data\\[User\\]\\[name\\]").val(); $.p...

Is this the only way to pass a parameter for Cakephp to work with JQuery Ajax

Hi all, I was doing some self-learning on how to pass data from JQuery Ajax to a particular URL in CakePHP: I have tested three sets of codes that the first one was working well, but the rest failed to work, which makes me so confused. Could some experts here tell why the second and the third sets of codes failed to pass any data? Set...

Scaffold is ignoring class file in CakePHP

Hi, when using scaffolding on a controller the views render fine and the app even attempts to insert the data; the problem is that the scaffold is completely ignoring the relations I'm defining in my model class, in fact it's ignoring the class entirely as I can delete the file and the controller still scaffolds and render the crud from ...

Error appearing in application after updating cakePHP library files from 1.3.0 to 1.3.1

Hi everyone, I have just updated my cakephp library to latest version 1.3.1. Before this I was running v1.3.0 with no errors. After running the application I am given this error message. unserialize() [function.unserialize]: Error at offset 0 of 2574 bytes [CORE\cake\libs\cache\file.php, line 176] I updated the libraries simply by r...

CakePHP: How to limit number of records from associated model

In a simple CakePHP model where User hasMany Item (and Item belongsTo User)- Suppose 50 users, have each 10 items. How can I find() only 5 users, each with the latest 5 items he has? When I impose a limit in the find, it only limits the number of users, not the number of associated Items. Thanks! ...

CakePHP on IIS7 - no css/js/img

I can’t get the css, js and img loaded. I’ve been using the web.config out of this article: http://book.cakephp.org/view/1533/A-Note-on-mod_rewrite Please any suggestions… ...

CakePHP ACO based on each entry

I'm trying to make a blogging system but obviously certain users in certain groups should only be able to edit/delete their own posts/comments. How would I go about doing this in CakePHP? I followed the manual's basic Acl guide to setup my current Auth system. ...

Saving data from another model (my own log system)

Hi! I´m trying to write a log system for my CakePHP intranet. What i need is to store de username/datetime whene someone tryes to login. My login code is on the clients_controller and i need to store the data on a model called log (i have the model, controller, view... but they are not related) how can i achive that? thank you ...

How to extract and translate CakePHP core strings?

How can I extract strings defined in the CakePHP core (like the auth component messages) with the cake i18n console? I tried to run cake i18n extract with both the path to the app folder and the cake folder but this did not give me the cake core strings in the .pot file. ...

CakePHP ROOT constant

The CakePHP ROOT constant, where should it point to? ...

Ajax get throws a syntax error when ip is given instead of localhost

Hi , i am working on cakephp. I have developed an application where i have used localhost in all ajax post and get.. like var ht = $.ajax({ type: "GET", url: "http://localhost/FormBuilder/index.php/forms/getInvitees/<?php echo $emailid;?>", ...

Is it a proper way to access a private function in cakePHP

Hi all, In a controller, I got two functions that one is made to be private: function toavail(){ $this->autoRender=false; $result2=$this->__avail(); if($result2==0){return "OK";} else{return 0;} ...

setting base path in cakephp

Hi , i am working on cakephp. i have my app in my localhost.. And if i try to run my app in other machine , i need to do set base path ... how to do this so ?? Please give some suggestions of how to do this?? Thank you ...

I can't insert NULL values into datetime2 fields in SQL Server

Hi! I'm using CakePHP. When trying to insert a null value into a field it turns into 1900-01-01 00:00:00. Here's a sample of my code: $this->save(array( 'date_signed' => null )); What seems to be the error and how do I fix it? Thanks in advance! ...

How to pass parameters from one controller to another in CakePHP?

Can anyone tell me how to pass parameters to a function in another controller in cakephp? ...

CakePHP two forms next to eachother instead of below eachother

Im developing an form in cakePHP where i want to set two forms next to eachother. Im creating it using this code. echo $form->input('timeback', array('options' => array('week',1,2,3,))); This creates a dropdown. Followed by this code: echo $form->end('submit'); This all works well, accept that these two forms should be next to eachot...

Internet Explorer randomly drops sessions between pages in cakePHP

Hello everyone, I've come across an extremely unusual bug that my team has literally no idea how to solve. Doing some research, I found some similar solutions that I thought would work, but alas did not. Here is my situation, let me know if I can provide additional insight to help solve the problem. The first step is that someone choos...

Access shell methods in controller? Cake PHP 1.3

I wrote a shell method in CakePHP 1.3 that has a return value. I'd like to be able to access that method from within a controller, so that I can pass its return value into the View. I'm not sure how to access those methods appropriately from within the controller. Have I done it wrong? I could easily duplicate the code, but I'd lik...

Redirecting to wrong relative address

Hi All: I have an issue with not getting the correct relative url. Right now, say my home page is at (please ignore quotation) "http://www.foo.com/user/home" I have links on the homepage that should go to "http://www.foo.com/user/home/page1" but right now I'm getting "http://www.foo.com/page1" Everything worked locally, can t...