cakephp-1.2

CakePHP: Action runs twice, for no good reason.

Greetings everyone! I have a strange problem with my cake (cake_1.2.0.7296-rc2). My start()-action runs twice, under certain circumstances, even though only one request is made. The triggers seem to be : - loading an object like: $this->Questionnaire->read(null, $questionnaire_id); - accessing $this-data If I disable the call to load...

Disable Cakephp's Auto Model "feature"

In cake 1.2 there is a feature that allows the developer to no have to create models, but rather have cake do the detective work at run time and create the model for you. This process happens each time and is neat but in my case very hazardous. I read about this somewhere and now I'm experiencing the bad side of this. I've created a plu...

CakePHP multi-model view

Heyall, I am creating a website in CakePHP and I am kind of new on it. I couldn't find good resources on this matter, so there you go: I have a three table structure for registering users: Users, Addresses and Contacts. I have to build a view with info of all three tables like: Full Name: [ ] (from Users) Shipping Ad...

Saving information in "sub" model in CakePHP

I've got a simple CakePHP site (1.2). I've got a page where you can edit and save a Person. So I have a Person model and controller. Each Person has none or more comments, in the comment table. So I have a Comment model, and I have a hasMany association on my Person model to the Comment model. View is working great. My question is, on ...

Add dismiss control to session-flash() output in CakePHP

In a CakePHP 1.2 app, I'm using flash();?> to output messages like "Record edited". It's working great. However, I want to add a link called "Dismiss" that will fade out the message. I know how to construct the link, but I don't know how to insert into the output of the flass message. The flash message wraps itself in a DIV tag. I wan...

Best practice for placement of display logic in a view in CakePHP

I have a CakePHP 1.2 application. I'm running into the case where I need to do some logic to render things correctly in the view. Example: I have a table called Types. There are flags for various types, so each row has one or more BOOL fields set. For one type of type, I store the contents of an RTF in another field. So when I displa...

Three table related model in CakePHP

I've got a CAkePHP 1.2 site. I've got three related Models/tables: A Comment has exactly one Touch, a Touch has exactly one Touchtype. In each model, I have a belongs to, so I have Comments belongs to Touch, Touch belongs to Touchtype. I'm trying to get a list of comments that includes information about the touch stored in the touchtyp...

How to pass querystring to testAction in CakePHP 1.2?

In CakePHP putting a querystring in the url doesn't cause it to be automatically parsed and split like it normally is when the controller is directly invoked. For example: $this->testAction('/testing/post?company=utCompany', array('return' => 'vars')) ; will result in: [url] => /testing/post?company=utCompany While invoking the u...

CakePHP 1.2: How do I lock a given controller from access from anyone but admins?

I'm not looking for the whole ACO-ARO implementation... I just want to use Auth, and check against the user's role.... What do I put where in order to simply deny users from a given controller unless they have a certain role. I'm trying to use the $this->Auth->authorize = 'controller'; ... but I don't even know where to put that?? An...

CakePHP find() based on HABTM relationship

Hello, I'm working on a CakePHP 1.2 application. I have a model "User" defined with a few HABTM relationships with other tables through a join table. I'm now tasked with finding User information based on the data stored in one of these HABTM tables. Unfortunately, when the query executes, my condition is rejected with an error about a ...

CakePHP Gurus: Console cake command not finding -app path correctly?

I've installed the CakePHP core files in this folder: /home/iopener/webapps/cake_1.2.1.8004 I've got my app installed here: /home/iopener/webapps/Smasholi.com/app The cake console command is in my path, and runs fine, but it seems to be ignoring any attempt to point it to the correct -app folder. If I run 'cake' from inside the app f...

Why is the CakePHP authentication component not hashing my password?

I'm using CakePHP 1.2 with Auth and ACL components. In my user register action, the password is coming in unhashed. Specifically, this expression: if ($this->data['User']['password'] != $this->Auth->password($this->data['User']['confirm_password'])) This is evaluating to true, even when I submit identical values for password and...

Customizing the style and location of $session->flash's output in CakePHP 1.2

I'm writing a simple web application using CakePHP version 1.2 (the latest) and am having an issue with displaying the flash message from the Session helper. In my layout, there exists the following code: <?php echo $this->renderElement('flash'); ?> Which renders the following element: <?php if($session->check('Message.flash')): ?> ...

CakePHP problem bake views (EasyPHP, MySQL)

I CakePHP (cake_1.2.2.8120) and EasyPHP (3.0) installed on Windows Vista Ultimate. I followed the "baking" tutorials online, successfully set the database connection with the "cake bake" command from the CLI. I baked the controller for my "Users" table using the "php cake.php bake controller Users" command - worked fine. However, when I...

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

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

cakephp .htaccess, mime-types

I have a cakephp 1.2 app (1.2.2.8120) and I am trying to change the mime-type for Japanese cell phones on certain pages with this one line of code in the app/webroot/.htaccess file: AddType application/xhtml+xml .xhtml This works for .xhtml files uploaded directly to the webroot folder, but regular cakephp pages don't work. I have tri...

CakePHP Auth Component Using 2 Tables

CakePHP Version 1.2.5 I would like a single user to have multiple email addresses. I would like a single user to have a single password. I would like users to log in using any of their multiple email addresses and their single password. I have created a users table with an id and a password field. I have created a user_email_addresses ...

dropdown select in cakePHP

Hello, I am using CakePHP 1.2. I have a person model that hasMany 'Document'. When I edit a document, the select box for the owning person appears (echo $form->input('person') where person has been defined in the documents_controller like this: $allPeople = $this->Document->Person->find('list', array('fields' => array('first_name')))...

Using DISTINCT in a CakePHP find function

Hello, I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter combination, click filter, and the page shows only the records that match. In people_controller, I have this bit of code: $first_names = ...