cakephp

jquery sending cross domain data via A $.post

I am trying to send data over to a cakephp (mvc) website, via $.post(). below is the code $('#testReq').click(function(){ console.log('Button Works'); $.post('http://play.anthonylgordon.com/usersessions/store/', {data:'test7'},function(data) { //data contains the json object retrieved. console.log(data.status); },"jso...

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

cakephp save returns true but does not save

Hi, CakePHP is driving me nuts! Here is my code: if($this->Page->save($datavalue)) { $this->Session->setFlash('Page content updated successfully.'); } else { $this->Session->setFlash('Page content was not updated.'); } it always says updated successfully, but nothing is updated in the database. Here is the content of $datavalue: Ar...

returned inserted id using $this->query in cakephp

how i can get the inserted id when I insert a record in this way using cakephp $this->query (" insert into [tablename] ([colname]) values([colvalue]); ...

Validation Errors not showing.

I am trying to validate a user when they register to my application. Nothing is getting set to validationErrors, which is strange can anyone help me out? Here is my MembersController <?php class MembersController extends AppController { var $name = 'Members'; var $components = array('RequestHandler','Uploader.Uploader'); function...

how to point to my correct address in this situation?! need help..

I plan to add up a calender function to my system, but i had mess up with the link which not link to the direct address that i want.. i am still new to cakephp, need some help to get understand the code and the correct way for me to point to the correct address i want.. here is some of the code in the controller, other side is not a pro...

PHP admin screens for Flex objects

I am creating Flex application that will call PHP via Zend_Amf. It's basically CRUD operations with file uploads sometimes. This will require to create admin screens for PHP side (for editing various records on server) automatically, using scuffolding. It seems that CakePHP would do well at generating admin screens. How well does Cake...

cakephp retrieving multiple values in a column

I want to retrieve multiples values from a field. the code I am using this this $conditions = array('Tag.name'=>$compare);//$compare = array('value1', 'value2',..); $values = $this->find('all', array('conditions' => $conditions)); But It keeps coming out like this SELECT `Tag`.`id`, `Tag`.`name`, `Tag`.`count` FROM `tags` AS `Tag...

Cakephp console (bake) on Mac OS with Mamp : database connection error

Hi I am trying to do the Simple Acl controlled Application tutorial in the cakephp cookbook. The idea is : Making Databases CREATE TABLE users ( id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL UNIQUE, password CHAR(40) NOT NULL, group_id INT(11) NOT NULL, created DATETIME, modified DATETIME ); ...

Need to make full names in cakePHP

Hi all, If I have a person model with first_name and last_name, how do I create and display a full_name? I would like to display it at the top of my Edit and View views (i.e. "Edit Frank Luke") and other places. Simply dropping echoes to first_name and last_name isn't DRY. I'm sorry if this is a very simple question, but nothing has ...

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

Specify which model relations to load

I am a beginning Cake user but well versed in php and frame works in general (I used to use Code Igniter). How can I call the model below and only return the Artist records and the related ArtistImage records, not the Album records. class Artist extends AppModel { var $name = 'Artist'; var $hasMany = array('Album', 'ArtistImage'); ...

Cakephp generating xml error - blank space

Hi, I am trying to generate a dynamic xml document in CakePHP to output to the browser. Here is my controller code: Configure::write ('debug', 0); $this->layout = null; header('Content-type: text/xml'); echo "<?xml version=\"1.0\"?>"; View is something like this: <abc> something </abc> The output is probably as expected: <?...

CakePHP Connection problem

Hi guys! I'm having a little problem here. I'm starting with CakePHP and i've created the example database from the book CakePHP from Novice to Professional. So, i've my mysql database created and everything seems to be right. I've many databases and can access all without any problem. But today, after Baking some controllers, somethin...

CakePHP Pagination with conditions on has_many

So I have a User table and a History table with User hasMany Histories, and I'm trying to implement pagination on the user table. My problem is that I have search, and some of the things one can search by are things in the History table. Is there a way to filter pagination results based on data in a table associated by hasMany? Containa...

Prevent controller from trying to autoload model

I am a beginning Cake user and trying to do some work on an already existing application. Running into a problem when I create a new controller. I have created StoreController and when I try to call methods inside it I get the error below. There is no table 'stores', but it seems like it's trying to automatically load a model relating to...

check for error

I have my own AppCotroller and using the beforeRender method to make changes to $this->viewPath based on the desired output format. Is there a way I can check if Cake is currently outputting an error message? If I change the viewPath and then it's displaying an error (like can't load model, etc) it will error on the error :) ...

Combining add and replacing values

Im curious to know if php has a function that allows me to connect 2 arrays together and replace values from array1 with values of array2 if the values from array2 already exist. see example array1('value1','value2','value3',); array2('value4','value2','value1'); array3 = functionEmerge(array1, array2); array3('value1','value2','value...

array conversion in php

how would you convert this array: Array ( [0] => Array ( [Contact] => Array ( [number] => 0425 234 634 ) ) [1] => Array ( [Contact] => Array ( [number] => 2939 492 235 ) ...

cakephp + cache query + after refresh lost all data except cachedata

hello world! in my controller i cache some paginatedata. after refresh (f5) i get only the data from the cachequeryfile but i lost ALL other data in my view. why? cachingmethod: file cakeversion: 1.2.5 codeexample: $url="home_page_1"; if(!Cache::read($url)){ $data = $this->paginate('Article'); Cache::write($url, $data); } $da...