cakephp-1.3

CakePHP: virtual fields containing model related data fields

Hi there. I've got a model Employee which belongsTo an Address-model. When I fetch data from the Employees model, the associated Address record gets fetched too. Additionally, the Address model has a virtualField full_name. This looks like this: Array ( [0] => Array ( [Employee] => Array ( [id...

CakePHP - Using the RSS Helper without RequestHandler Component

I have set up the RSS Helper (with CakePHP 1.3.4) and all is working - I can access my feeds by /news/feed.rss - as exampled at http://book.cakephp.org/view/1461/Creating-an-RSS-feed-with-the-RssHelper But I want to be able to do this conditionally, in sudo, something like: if (!empty($var)) { switch ($var) { case one : ...

How to get CakePHP's migration plugin to work under windows?

I have a running CakePHP 1.3 site under Windows using ZendServer CE. I have also added win-bash and such in my Path. Console seems to work fine, except when trying to use the migration plugin. Seems no matter what I try i get: "Error: Class MigrationShell could not be loaded." Anyone else had this issue? ...

cakephp console issue : not able to set path

Hello all I am trying to create a controller in cakephp(1.3) using console. I am using windows XP and XAMPP. My current cake console settings below C:\xampp\htdocs\cake\apressblog\cake\console>cake ♀ Welcome to CakePHP v1.3.4 Console --------------------------------------------------------------- Current Paths: -app: console ...

CakePHP: $this->Auth->allow() and $this->Auth->allowedActions() - when do I use them?

What is the difference between using the method $this->Auth->allow() and setting the variable $this->Auth->allowedActions ? I can't find any information about setting the allowedActions array where I expected to find it (http://book.cakephp.org/view/1251/Setting-Auth-Component-Variables) - but it exists in the API at http://api13.c...

CakePHP: Make datafield admin-editable only

In my data model, I've got a field that should be admin-editable only. Normal users can edit records in the model and view this specific field, but they should not be able to edit it. Is there a simple/clean approach to do this? I guess that it's necessary to create an extra admin_edit controller action, but what's the best way to "lock"...

File Upload validation only on record create, not edit

I've got a form that allows a file upload and I'm using data validation to check what type of file it is and that's all good. What I want to do is then allow them to edit that same record but a file upload at that time is not needed. My validation rule is as follows: 'header_pic' => array( 'extension' => array( ...

not able to create controller from console : cakephp : showing fatal error

Hello all I am trying to create a controller in cakephp(1.3) using console. I am using windows XP and XAMPP. My current cake console settings below C:\xampp\htdocs\cake\apressblog\cake\console>cake ♀ Welcome to CakePHP v1.3.4 Console --------------------------------------------------------------- Current Paths: -app: console ...

cakephp 1.3 : getting warning: strtotime() on console

Hello I am trying to create a controller in cakephp using console. But when I try to do so,I am getting a warning on my console window as follows How can i fix this issue ? C:\xampp\htdocs\cake\apressblog\app>cake Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use t...

I selected cakephp as my php framework for my upcoming projects, Is this a good decision ?

Hello I am planning to continue my PHP life with cakephp, I have been a PHP programmer for 2 years,but haven't touched any frameworks, I have to complete a quite big projects immediatly, Is this a good decision ? ...

CakePHP model->save(): save all but some excluded fields

Hello everybody. I want to save all but some excluded fields. I know that I can do it this way $this->Blah->save($this->data,false,$fieldList) Where $fieldList contains all the data fields of the table but these I don't want to get saved. I have some tables that have maaany data fields, and I don't want to write the whole list from sc...

Intelligence when segmenting a datetime value

I have a datetime value in my Event model. Not being a big fan of the default aesthetics of Cake's automagical input, I'm going to create my own. My understanding, though only from reading, is that Cake provides some intelligence around concatenating datetime values on save. Specifically, it will detect month, day, year, hour, minute and...

Cakephp app with mobile views

I am building a cakephp app - its a food recommendation service. and i would like to have mobile views for that. i just wanted to know of the best practise on how it can be done. Problem is i will have to feed mobile views and city also i wil have few cities which so to address a City 1 its will be either city1.website.com or websit...

Unable to download files- PHP

This is the code I am using. As suggested I have added the headers for content type and disposition. <?php header('Content-Disposition: attachment'); header('Content-Type: application/octet-stream'); $con = mysql_connect("localhost","root","admin"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("acl_...

cakephp : admin routing issue : Parse error: syntax error, unexpected '/', expecting '('

Hello I was trying to create an admin for my controller Posts, I used cake console option to create controller, I type Y for the question "Need admin routing ?", I entered Y and I got written my controller with admin functions, one of my admin function looks like this function admin/controller_view($id = null) { if (!$id) { ...

Cakephp - how to can error pages have its own layouts ?

i wanna have a different layout for the page not found 404 page. how can i set a differet layout for that page ? ...

Cakephp Auth: $this->Auth->loginError message

I am using Auth Component. I am setting $this->Auth->loginError in the beforeFilter. But i have another posibility. If the user entered username and password is correct but User.status = 'pending' how can i can show a different message. i am using $this->Auth->userScope to set that. but how to show different $this->Auth->loginError for t...

Cakephp: How to read User Data in Session ?

I wanna gather the latest information of a user from the User Model and store it in the session. so i am doing this // Before Render function beforeRender() { if($this->Session->check('Auth.User')) { $this->User->recursive = -1; $currentUser = $this->User->read(null, $this->Session->read('Auth.User.id')); ...

CakePHP: Doing Complex Find

In my application i have a threaded commenting system which i call status messages. i have a few models as follows users(id, name......) status_messages(id, message,......, user_id) status_replies(id, message,......, status_message_id, user_id) is this the right way of writing a commenting system ? A user can set status messages and...

cakephp 1.3: displaying row id instead of row value, please help

Hello guys, I am using cakephp 1.3, I am having a small issue,please help I have 2 tables in my database Profiles and qualifications, Profiles belongs to qualifications and qualifications has many profiles. qualification display_field is set to 'qualification', I used cake bake all for creating CRUD, when I try to add profile I get the...