cakephp

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

CakePHP multirule validation

I am trying to get multiple rules to run during an upload validation. One validation is built in and one is custom. The custom one works fine however the built in one is not working. The custom one extension was working on another field earlier just fine. Do I have this setup correct? var $validate = array( 'description' => ...

How to add new child of many to many relation in cakephp parent add form?

I'm learning cakephp for some time and it's very nice, I'm using the cake bake to create my classses. Suppose I have a animal entity and a food entity and they have a many to many relation, and I'm on the add animal view, how can I add the option to add 3 new foods to this animal on this view? and what should the controller code look li...

How to pass data in url using cakephp?

I wanted to now if there is a way to pass a simple string inside url and cakephp some how put it inside one of the inputs of my form without any code writing on view side? I tried calling this->set("bla","bla"); the field name is bla but nothing changed in view ...

Action not running with CakePHP Js->submit()

I'm using CakePHP 1.3, and trying to make a simple message posting board with ajax. I'm trying to use the Js helper to submit a form on the index page, then refresh the message board's div to include the new message. This is all on a single page. I have previously posted on this, but I wanted to rephrase the question and include some u...

special cakephp model relation

hi, I'm making my first CakePHP project (apart from all the tutorials I did...). I'm making a site for trainers and athletes in the athletics sport. now in my database I have a user table with fields: id, username, firstname, lastname, email, password, ... then I have 2 other tables with the fields: trainers: id, type_id(sprint, dis...

Modules in CakePHP

Hi everyone! I am using this awesome framework during 6 months and I learnt a lot about it, but I wonder if it's possible to create an internal structure to simulate modules like in Codeigniter. I know there is the possibility to use plugins for that, but it seems too difficult to connect it together and pass info between them. My goal...

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 - Multiple image upload with sort & preview

Hi, I've been trying to figure out how to do this functionality but it's a lot harder than I thought. Can anyone give me a pointer / point me to an existing component on how I can achieve the functionality in the image attached? So what I have is, I have a Model called Instruction. And Instruction has Steps. Below is the form for St...

How to do a within-group aggregate query in MySQL?

I am trying to get the latest modified "posts", from a group of "posts", that all have the same parent_id. I already learned today that grouping is not the answer, and that I should either use an inner subquery, or a "within-group aggregate", thanks to this site >> Aggregates >> Within-group aggregates. I chose to go with the latest, as...

CakePHP webroot not accessible on new Apache setup

I've just set up a new Ubuntu 10.4 slice on Slicehost, and have installed apache, mysql and php. I've uploaded my CakePHP app and everything is running fine, except for the webroot being inaccessible. I have tried adding AllowOverride to all in /etc/apache2/sites-available/default and followed the Cake instructions to httpd.conf by addi...

beforFilter in codeIgniter

What is the best way to do and equivalent to CakePHP's beforeFilter() in codeIgniter ...

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 log in redirect to requested URL

When a user clicks a link that requires a log in, we currently redirect them to the log-in page ,but we lose the intended URL. What is the best way to account for that URL and redirect the user to the requested page once logged in? We're using the latest stable version of Cake. Thanks. --Edit-- Its configured like this $this->Auth->...

CakePHP / Session Variables are Randomly Getting Dropped when Paginating

I am storing values in my session in one of my AJAX calls. The session is getting overwritten correctly. But when I make some other call (AJAX or non-AJAX), the session value is lost. This doesn't happen every time but in most of the cases. My security level is on medium already. here is the controller function and the view : http://bi...

CakePHP: help me with error validate ( why error is miss field when data have that field )

Gallery model var $validate = array( 'id' => array('rule' => 'numeric', 'required' => true, 'allowEmpty' => false, 'on' => 'update'), 'name' => array('rule' => 'notEmpty', 'required' => true, 'allowEmpty' => false, 'on' => 'create'), 'model' => array('rule' => 'notEmpty', 'required' => true, 'allowEmpty' =...

MVC conundrum: How can I solve this problem and keep logic out of the view?

I'm building a site with CakePHP, but this question is more about solving an MVC problem than it is a CakePHP problem. I have a User Model and a Group Model. This is a HABTM relationship, so different users may belong to multiple groups. One controller on my website handles the blog. It has many methods, but all of the views share a ...

cakephp allocate huge memory on a new server

I have a site using cakephp1.2.8 running on a ubuntu9.04 server. It works fine with 16M memory_limit. Now I moved the site to a new CentOS5.5 VPS. Then the server starts to show errors like this: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 342095888 bytes) in Unknown on line 0 It displays pages cor...

Identify whether user manually loaded url on browser or generates URL by server in php

Hi Thanks for your time. I am developing application using PHP. In this for some instace I have added logic such that, for certain area matches then redirect to particular url. if(//statement) { redirect to specific URL(e.g. http://www.example.com/testing.php ) } Above is my basic logic. Here I want to Identify that whether use...

jQuery (Focus & Blur) not selecting fields loaded using $ajax->observeField()

Hi There, I've added a tooltip feature to my application because parts of the ordering system can be confusing to some of our newer users, it's simple jQuery: $(document).ready(function(){ $('input, select, textarea').focus(function(){ $class = $(this).attr('title'); $('.tooltip_' + $class).fadeIn(500); }); ...