cakephp

Making one of a group of similar form fields required in CakePHP

I have a bunch of name/email fields in my form like this: data[Friend][0][name] data[Friend][1][name] data[Friend][2][name] etc. and data[Friend][0][email] data[Friend][1][email] data[Friend][2][email] etc. I have a custom validation rule on each one that checks to see if the corresponding field is filled in. Ie. if data[Friend][...

CakePHP home page - cache not working

In my CakePHP home page, I get the message: Your cache is NOT working. Please check the settings in APP/config/core.php I googled for possible solutions, some of which were to uncomment the Cache.check and Cache.disable line. Even then the error isn't resolved. Also the webserver runs on www-data (exec('whoami');) whereas my home fold...

How do you perform Form validation without model in Cakephp?

I need to perform some validation. I don't have model in the application. Does anyone know how to do the validation without model? Can you show me using a small sample or statement? ...

In Cakephp, what is Session->valid()?

I know that this method answers the question "Is the current session valid?", but I don't see why it would ever be invalid. I've read the source for this method, but I still don't get it. From what I can gather, it has to do with whether the session data has expired, but I'm not sure. This may pertain to an older version of Cake because...

In Ajax->submit how to find the submission was success

I have a view that contains a hidden <div>. I show the hidden <div>, and when I click on submit in the hidden <div>, I want to know the whether the result is a success or failure. In case of failure the <div> must not hide. Right now, it is always hidden. ...

Array of parameters

CakePHP makes heavy use of associative arrays for passing large numbers of parameters to functions. I have not really seen this technique outside of PHP and never seen it used to the extent that Cake uses it. I really like this approach because as it seems it would be easier to handle new parameters in future releases of your own code an...

Log out with Facebook Connect in a Cakephp app

I want to include Facebook Connect in a Cakephp app that I'm working on. Right now, I'm trying to implement auto-login with Facebook Connect. I'm able to start a new login session by writing stuff to $this->Session whenever a user's Facebook Connect status is "connected", so I've got the first half of the feature working. The problem com...

using CakePHP 'Acl' component

Hi , I'm a newbie to CakePHP components. I had built a CakePHP application which has a login feature. I had not used "Auth" component but was using my custom method for authenticating. Now I want to use the 'Acl' component in the same appllication but I'm unable to do so because it requires the "Auth" component also. Is it possible to ...

CakePHP Custom Global Function

The application I am working on have several database fields called "active", which is boolean. However, instead of displaying "1" or "0" in views, I would like it to say "Yes" or "No". I have the following function: function activeFriendlyName($status) { if ($status == 1) { return "Yes"; } else { ...

CakePHP views part

Hi, i am having a doubt in my application(CakePHP).i want to retrieve the values from the Table named choices i am retrieving it correctly.The values are coming correctly in the controller part But in my view part its showing only the last values retrieved .. My code is, function view($formid = null,$userid=null)//viewPage {...

How do I pass a target parameter to a CakePHP redirect?

I have a module built in CakePHP that is hosted within an iFrame. I need to have a redirect target the parent page. Using normal HTML I do: <a href="#" target="_parent"> But how do I do that for CakePHP redirect? $this->redirect('http://www.url.com'); ...

solution for extra space in div element

In my application I am using a div element. There is some extra space found below and above the div element. How can I remove that? Thanks ...

CakePHP HABTM question

Might be a newbie question as I'm trying to see what all these "PHP frameworks" are at my free time. For starters I want to add multiple tags to multiple photos. I have a tags model and mot model (the photos). Snip of mot model: var $hasAndBelongsToMany = array( 'Tag' => array( 'cl...

how to use a common data across action in a controller

In my application am getting some values through webservice on the action index in controller. I want to use the same data in other actions also. How to implement it without calling webservice again. Thanks. ...

passing argument to ajax call from view

In my application i need to pass one argument to controller through ajax call on textbox keyup. through submit its wotking but i need thro keyup and ajax is must. Anyone plz explain using small sample Thanks, ...

Selling a Script Built on a PHP Framework

Hello everyone, There are a ton of PHP frameworks out there (i.e. Zend, Seagull, Symfony, CodeIgniter, CakePHP, Yii, Prado) that do a great job of implementing important pieces of a scalable/maintainable website, and I almost always pick one to start building client websites. As of recently, I've started getting tired of providing cons...

Uploadify - files not showing up

I'm trying to use Uploadify (a jQuery plugin) with my CakePHP app. Locally (WampServer), it works great, but when I try it on my live server (Dreamhost), the files don't show up. I've properly chmod'ed the folders, checked the paths, etc, and I can't make any sense of why it isn't working. Here's upload.php: if (!empty($_FILES)) { ...

Is it possible to loop through all the items of two arrays using foreach?

I have two arrays: $Forms and $formsShared. <?php foreach ($Forms as $r): ?> $("#shareform<?=$r['Form']['id'];?>").hide(); $(".Share<?=$r['Form']['id'];?>").click(function () { $("#shareform<?=$r['Form']['id'];?>").toggle("show"); }); <?php endforeach; ?> Currently, I have this hide and toggle function for each For...

having trouble with cakePHP Bake and one of the database tables

Hi, I am using Bake to create models for my database tables. I have run into a little problem. I have 25 tables .... I strated baking the models until for one of the database tables the bake started giving a name of it own to the model,file and class. For example ,the table in database is named : 'risk_manager' (It has association ...

Reading Session value in beforeFilter() cake php

I am using the app_error script to deal with broken links on my site, and in the error404() action I write a session value like this: $this->controller->Session->write("visitor", $visitorId); This all works as I can successfully read the session back if I reload app_error. Once I have written this session value I redirect to a control...