cakephp-1.3

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...

problem occures in if condition

I am tring to give condition, but it cant give appropriate result. like if($this->data['EmployeeExprienceDetail']['file_name']['type'] != 'image/jpeg') is this condition is ok or not...guide me thanks ...

problem displaying habtm relation of a specific user

Hi, I got 3 tables (Accessories, User, Accesories_Users)... At Accessories_Controller im trying just to get the accessories from the user logged in, so i set the recursive=1 and then execute the find... The problem is, if i do $this->Accessory->find("All", array('conditions'=>array('AccessoriesUser.user_id'=>$this->Auth->User('id'), ...

Cakephp Containable or Tree ?

I have a db with the following tables user(id, name....) restaurant(id, name...) module (id, name ) status_messages(id, pid, message, module_id, ModuleID) Module Refers to either Users or Restaurant. Both Users and Restaurants can have status_messages. When a user (id=21) sets a status message (1, 1, 'Message', 1, 21) When a...

CakePHP AJAX request fails to show new content and uses wrong layout

I'm using CakePHP 1.3.2 with jQuery 1.4.2 and I'm seeing some strange behaviour with AJAX requests. Intermittently, when clicking an AJAX pagination link I'll see 2 POST requests instead of 1, the first of which is via XMLHttpRequest, the second of which isn't. The first request never completes, but returns a full page using the default...

find by column name cakePHP

Hello I have been trying to understand how to get data from model by the name of field. I am using cakePHP, and I need to retreive a column's data from a table. The syntax is > "select name from permissions" So I tried to find out on book.cakephp.org, so I got the field function, but that only gives me the first value, while I have mo...

cakePHP: Why are my model associations not working as a plugin?

I have a relationship as follows. Game -> hasMany Highscores Highscore -> belongsTo Games, Users When I run the MVC files standalone (within their respective places in the app dir), I get all belongsTo data associated with Highscores. However, when I run the same MVC files as a plugin, within the plugin dir, these associations are l...

Cakephp - find thread

i have a tweet table that stores tweets and its replies like this tweet(id, parent_id, tweet_message, time) where parent_id is a self id if its a tweet and is of parent id if its a reply. how to do a find to pull out tweets where id = parent_id example: tweet(1, 1, 'My name is Harsha', 'time') parent_id = id since its a tweet and...

Can't echo $session->flash(); in CakePHP 1.3.4 - Allowed memory size exhausted

I am using: $this->Session->setFlash('gotcha!!', 'msg_success'); to write a msg in the Session and try to access it in the file \app\views\elements\msg_success.ctp with the code if($session->check('Message.flash')) { echo $session->flash(); } My Phpinfo() says memory_limit 512M 512M My app/config/core.php says ...

Cakephp ACL redirect when a user has insufficient privileges

First you should be aware that I am a new cake convert. Ok, from what I can tell when a user try's to visit a url they do not have sufficient privileges for, the ACL redirects them to "/" if Auth has loged them in, and login if the user is not already loged in. Also Auth remembers the requested page and on a successful login will attemp...

CakePHP Containable Help

i am getting this error when i try the following Statement Statement $status = $this->User->StatusMessage->find('first', array( 'contain' => array( 'StatusMessageReply' => array( 'User' => array('condition' => array('User.id' => 1 )) ) ) )); Error Model "User" is not associated with model "Use...

CakePHP 1.3 paginate with custom query

I've managed to over-ride the default methods for a custom query in my model as suggested elsewhere, function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null, $extra = array()) and function paginateCount($conditions = null, $recursive = 0, $extra = array()) Unfortunately this approach over-rides all pagi...

Why is CakePHP duplicating my queries? (this is not the same "too many queries" problem that is usually asked)

I've defined these relationships in my models: Lead hasMany Job Job HABTM Employee Job HABTM Truck I'm trying to do a find('all') from my Truck model, and limit the results to: All Trucks, all jobs associated with those trucks that have a certain pickup date, the employees assigned to those jobs, and the lead associated with the jo...

stubs, dynamic homepage in cakePHP

Hey everyone. I'm working on a site for a client that wants to be able to update modifying their content. The brief was to allow them to edit pages, but not create or delete them. For the site I decided to work with cakePHP, as I've heard good things. First up, a quick explanation of my setup. I've got a single table, called 'contents'...

Array to Serialize

i have an array like this [Cuisine] => Array ( [0] => Array ( [id] => 3 [name] => Arabian [slug] => [CuisinesRestaurant] => Array ( [id] => 194 ...

ACL and AllowedActions Issue with CakePHP 1.3

Originally, I would run terminal commands to generate my ACL table data. However, this became tedious so I now use the below code to automatically generate my ACOS, AROS, and AROS_ACOS tables: http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs I also created these two functions to help populate those tables: function...

Cakaphp and facebook

I have a site built with cakephp (1.3), where users can manage lists of items. I now want to develop a facebook app that will work with the data of my web-based site. The facebok-app is to replicate many of the web-site's functionality (basic CRUD and more), so I would like to reuse as much code as I can from my current cake- just use a...

CakePHP: Containable behaviour doesn't work with find() even if contain() is called in beforeFind

Hello. My Problem: Linked to my Employees table I've got an Address table containing a virtual field called full_name (I guess you can imagine by yourself what it does). I added the Containable Behaviour and this function function beforeFind() { $this->contain('Address.full_name'); } to my Employees model, so that I don't have to...

Conditional Component Loading in CakePHP

I'm using the DebugKit component in my project but I want to turn it on only on the staging server and have it not load when running from the production server. I know I can turn it off with the debug config value but I want to keep that value at 1 for both servers. I tried conditionally defining a contstant 'DEBUG_KIT' in bootstrap.ph...

Sum of a field with hasMany in cakephp

I have two models in cakephp, Link and Vote. I want to have the sum of the votes for every link in my Link model. Here is a print of my findAll function : [1] => Array ( [Link] => Array ( [id] => 1 [url] => http://www.google.com [date_added] => 2010-08-19 11:36:56 ...