cakephp

Maintaining page number after redirect in CakePHP

I have an index view that lists items, and it's a long list so I use Paginator to limit items to 50-to-a-view. Each item has an "edit" link that goes to an edit view with inputs/validations/etc. When that form is submitted, I redirect the use back to the index view. So far so good, but here's the rub: If a user is on page N of the in...

[CakePHP] Environment detection and setup

Hello folks, I am a RoR developer, but I am presently working with CakePHP for a project where I cannot tweak the server. In my Rails production server, Passenger is setup to automatically use the "Production" environment, overriding the local app setup. I would like to setup my cakephp app to do the same thing. How do you usually accomp...

Validate field value using another field

Hi, I am trying to validate my model, I am using CakePHP 1.2.3.8166 and mysql 5 I have my model definied as it: class Actividad extends AppModel { var $name = 'Actividad'; var $validate= array('maxfield' => array( 'rule'=> array('chkValue'), 'message'=>'i2' )); function chkValue($data){ return $data["maxfield"]>=$data["minfi...

Validation in cakephp

Hi, I'm trying to perform validation in the login page for the name,email and password fields. If the input fails validation,the error message should be displayed. But here,when I fill in the details and submit, it is redirected to the next page. Only the value is not saved in the database. Why is the message not displayed? This is my...

How to use cache in cakephp

I want to use cache in CakePHP. How do I use it? ...

Using cakephp and uploadify

Does anyone have a good tutorial implementing cakephp and uploadify thanks, ...

interpret http_build_query($_POST) in cakephp

Hi, I am using CakePhp and JQuery in my application of FOrmBuilder. I am having form as like <form action="/cake_1.2.1.8004/index.php/results/submit1" method="post" id="ResultSubmit1Form"> <fieldset style="display: none;"> <input type="hidden" value="POST" name="_me...

validate function in cakephp.

Hi, Can anyone help me with a clear and complete example on how to set validations for 2 fields, say an email and password, with error messages? From my understanding, the correct format is: var $validate = array( 'password' => array( 'rule' => array('minLength', '8'), 'messag...

CakePHP: Is it possible to insert record with pre-defined primary key value?

I have a CakePHP model - User - that has ties to an external corporate system. I store some data on those systems and other data locally. In my User::beforeSave() method, I'm trying to set an ID, send the data (with that custom ID) to my corporate systems and then, if it inserts successfully there, return true so that Cake will insert th...

PHP File Management System

We need to create a file management interface that integrates with the clients current website built on cakephp. The file manager must only let the users see the files that they have permissions too. The user will be able to upload files(of any size) and have other users download those files (if permissions allow). This is no problem ...

Performing validations for the form in Cakephp

hi, I am using Jquery and cakephp for my application . I am having a form created in my page using $form->create of cakephp .THe form contains many fields which the user will fill it on and on submitting ,the data is saved by function submit($id = null) { foreach ($_POST as $key => $value): $this->data['Result']['form_...

Redirecting in CakePHP

Is there any other command for redirecting a controller to a particular view page other than redirect and render? I have the redirect as $this->redirect('/forms/homepage/'.$userId); But if I give $this->render('/forms/homepage/'.$userId); it doesn't get redirected to that page. Is something wrong? ...

Adding validations via submit button

Hi, I am using Cakephp and JQuery in my application. I have created the form using <?php echo $form->create('Result',array('action'=>"submit/$formid")); foreach ($viewfields as $r): echo $form->input($r['Attribute']['label'], array('id'=>$r['Attribute']['id'],'name'=>$r['Attribute']['label'],'type'=>'text')); endforeach; e...

Where to put custom and third-party classes in a CakePHP project?

I've just started working on an existing CakePHP project. I will be developing a class that does some operations on an Excel spreadsheet. Like a PEAR object, the class will be called by Cake components, but in and of itself it will not call any Cake components. Where is the best place to put the class file in the project hierarchy? ...

Improving quality of code in CakePHP

I have been using CakePHP for a few weeks now and its been an great experience. I've managed to port a site surprisingly quickly and I've even added a bunch of new features which I had planned but never got around to implementing. Take a look at the following two controllers, they allow a user to add premium status to one of the sites l...

Using Set::extract in CakePHP

I have a query to get all the compatible phones in a specific country, and in my controller I'm using Set::extract to reduce the untidy result array to just an array of product names. $results = $this->Country->compatiblePhones($country); $compatiblePhones = Set::extract('/p/product_name',$results); $this->set('compatiblePho...

CakePHP Pagination - how to remove "page:" from url for better seo/cleaner URL

When I use CakePHP Paging I get an url like this: http://example.com/php/page:2 What do I have to change in the controller, the view and the routes.php to create a working url like this: http://example.com/php/2 ...

CakePHP Console via Cron Question

I'm using the CakePHP Console to download files from we and processed in a database. I'm running the console from inside the "app" directory. But when I'm trying to run the console outside app and by just setting the "-app" parameter for my cron job, it doesn't work. To be honest, I've had no success using -app parameter. It's like it'...

Is there an interactive cakephp console?

For those that are familiar with Rails, you can do script/console in the root of an app, and you'll get an interactive shell that has all your app code loaded, where you can enter Ruby expressions, and their results will get printed on the next line. Is there something like that in Cakephp, or is console just for scripts? If not, cou...

Separate controller for home/index site in cakephp? Best Practice?

Hi, I´m starting to developing with cake php. I have designed a DB model and baked my mvc´s. Now i want a index / home site. This site should be an overview of possible actions which a user can do. Should I use an app_controller for that or route to an existing controller even if that controller has nothing to do with a home site, or ...