cakephp-1.3

how to prevent an element to validate

hi to all i am using cakephp framework for my project. in on of my form i take a checkbox on click on this two other text box are shown. by using cakephp validates method i validate the form data but i want that when the checkbox is not checked then it avoid the validation for that text box. it check only when the checkbox is checked. ...

CakePHP ACL use case(s)

I have got a simple web app in development, i want to establish a couple of user groups; Admin, Doctors & Patients. Each group would have their access restricted to particular controller actions rather than individual content. So for example, Doctors can view patient records (index & view actions), but cannot delete them. Usually i wou...

Cakephp problem with translation behavior

I use cakphp version 1.3. The documentation says, that if I want to use the translation behavior for my dynamic content no changes in my view are necessarily. The problem is, that the translated fields are there but empty. The translation only appears in the ['I18n'] array like this Array ( [0] => Array ( [Cat...

I am facing problem of read function in cakephp

hii..I want to edit single row.i used $this->data = $this->BuildingProperty->read(null,$id); but it didnt fetch the values of this id. so what can i do. Give me any suggestion. ...

read function problem (not read all fields) in cakephp

hi all, i want to edit row. view file contains dropwons with Ajax. i used $this->data = $this->CourseBuilding->read(null, $id); but it cant read all fields of that id. Can U help me. ...

CakePHP XML (1.3)

Whenever I output an xml file, I always get 9 blank lines of whitespace at the top, anyone know what the problem is? I also get a timestamp at the end which I don't want: <!-- 0.35s --> Here's the error: XML Parsing Error: XML or text declaration not at start of entity Location: http://example.com/controller/get Line Number 9, Column...

checkbox selected in edit section

Hi... I want to show checkbox selected in edit section if there have value in DB. i m using cakephp 1.3 version .in edit section how i will show valued checkbox true. Please help me as soon as possible. ...

Ajax update (prototype) for select box, the CakePHP way

I'm quite newby with ajax in cakephp and what I want to do is update one select form input element when user changes other. I have managed to do it previously with JQuery but I can't use it on this form, because it seems to conflict with prototype library that is used by $ajax->autoComplete() on one form element. I couldn't get it to w...

cakePHP performance

hello friends, when i am hosting cakePHP and database is in different servers it takes too much time to respond but when both are in the same server itz performance is good is there any way to tune performance of cakePHP keeping database in different server the performance of database server is good i already tested another applicatio...

CakePHP Media Plugin version 1.3, UUID filenames

Is anybody else using David Persson's media plugin for CakePHP? I'm struggling with setting up some features of the latest version. I'd like to set it up to make a UUID-based filename for uploaded images, but I'm not sure how to go about it. I will fight with it some more, but I'm posting to find out if anybody here can tell me if the 1...

CakePHP: How do I count the number of hasMany records in a find?

Hello I have two models, Post hasMany Comment. How do I select all Post that have less than two Comment? I tried using a find with 'fields'=>array('COUNT(Comment.id) as numComments','Post.*'), (and then doing a numComments < 2 in 'conditions'). But, I get a Unknown column 'Comment.id' in 'field list' error. Thanks! EDIT: I've gotten ...

How to change URL of pagination in CakePHP

I click on the next link. It shows me the URL like http://www.domainname.com/fj_messages/index/page:2 I want to change it like change this to fj_messages/index/page:2 Like message/inbox/2 Can I do like this? ...

fetch only 'enabled' records from the database in cakephp v1.3

Is there any way of fetching only those records of a model which have 'status = 1' in cakephp v1.3 ? I have created a field named 'status' in every table of my web application. I have a model named 'Message'. What I want is that only those messages are displayed, included in search results which have 'status = 1'. Messages with a 'stat...

cakePHP optional validation for file upload

How to make file uploading as optional with validation? The code below validates even if i didn't selected any file. I want to check the extension only if i selected the the file. If i am not selecting any file it should not return any validation error. class Catalog extends AppModel{ var $name = 'Catalog'; var $validate = array...

best practice to upload files in cakePHP

can any one suggest me the best way to write the code for uploading a file? I need to upload file and save the file name in table. if the record saving is failed it should not upload the file. If the uploading is failure then the record should be rollbacked. The code should be reusable I need to upload the file in afterSave callBack ...

HABTM association not being saved?

I'm attempting to create a simple 'tags' type of setup, allowing admins to 'tag' an image so it shows up in certain places. I've only started development and wanted to tackle this portion first. I literally just finished running bake, so everything at the moment is standard and I haven't touched any of the generated code. I have three ...

Routing: 'admin' => true vs 'prefix' => 'admin in CakePHP

Hi I'm setting up admin routing in CakePHP. This is my current route: Router::connect('/admin/:controller/:action/*', array('admin' => true, 'prefix' => 'admin', 'controller' => 'pages', 'action' => 'display', 'home')); It works fine, but I don't understand what the difference between 'admin' => true, and 'prefix' => 'admin' is. Whe...

cakePHP "required" validation

is there any mistake in this validation??? var $validate = array( 'brand_id' => array( 'required' => array(true), 'message' => array('select a brand'), ) ); brand_id is a select box It show error as "message" instead of "select a brand" if the message is not in array it shows error Warning (2): preg_match() [function.p...

How do I implement jqgrid v3.7 in my webapplication created using cakephp 1.3

I am trying to implement jqgrid v3.7 in my webapplication created using cakephp v1.3. My controller code is as follows function admin_index() { // get how many rows we want to have into the grid - rowNum parameter in the grid $limit = $this->params['url']['rows']; // get index row - i.e. user click to sort. At first time s...

How to limit db query data in CakePhp?

Hello, I want to limit my db data on CakePhp. It can be limited with find command but I don't know is it possible to limit with my usage. Here is my code from posts_controller.php file: function index() { $this->Post->order = array('order'=>'Post.date DESC','limit'=>5); $this->Post->recursive = 0; $this->set('posts', ...