cakephp

CakePHP: Why does validation fail to run?

I have started to look into CakePHP to increase my productivity. The problem is that I have run into a small problem, which has kept me occupied in more than one hour - when the form is submitted it is not validated. Even though I intentionally leave both fields blank it still saves and gives the OK-message. Hope somebody can help me g...

cakephp paginate model with multiple association

I have three tables : Units, Offers and Agents with following associations Unit hasMany Offers Offer belongsTo Agent When I paginate Unit table I get all the units and all the corresponding Offers for each unit , but not the Agent that offer belongs to. Ex:  Unit1   offer1   offer2  Unit2   offer1   offer2   offer3 ... And I want t...

How to retrieve contents from a uploaded file.

I am using cakephp framework. I would like to retrieve the contents of the uploaded file and store it in the database. I want to be able to search the content of the uploaded file. I was made aware that file_get_contents would work for plain .txt files. But all my documents are .docx and .pdfs. Is there any solution I could use. I app...

Cakephp, searchable behaviour help, returning empty results.

Hi, I'm using the searchable behaviour from the bakery. It is all set up correctly with no errors, so there is no problem there. However when preforming a search it returns no results. I'm at a loss as to why this is happening because of a lack of any errors. I think it might have something to do with initial set up or the indexing o...

if(something) vs if(something===true)

Hi all, I was doing some self-learning about cakephp (version 1.26). I got a simple HTML input text field like this: <input type="text" name="data[testing][name]" id="data[testing][name]"> The value from the Input text box field was checked against the database. If the value matches the data stored in the database, it will return tru...

$session->flash()

Hi all, I am using cakePHP v1.26. In the default.ctp file, I got a single of this code in it: $session->flash(); I came a corss a web site in which the author suggested using this instead: if($session->check('Message.flash')){ $session->flash(); } I do not understand what this line of code is doing: if($session->check('Message....

Having Trouble Allowing Only One Instance of a PHP Script at a Time, Using Cron

I can't seem to figure this one out. I have a validator-type script that validates certain files on my server (checks if exists, its contents, etc). I want it to run continuously with only one instance of it, not more. The current solution I have doesn't seem to work, I'm guessing due to timeouts (possibly other reasons too). For each f...

Headers already sent error in CakePHP app

function new_photo() { if( !empty($this->data)) { $this->data['Photo']['showcase_id'] = $this->Session->read('CurrShowcase.id'); $this->data['Photo']['added'] = date("Y-m-d H:i:s"); $this->Showcase->Photo->save...

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

Create array with Set Extract in Cakephp with conditions

I have the following array: Array ( [0] => Array ( [id] => 4 [rate] => 82.50 [pounds] => 2 [ounces] => 3 [mailtype] => Package [country] => UNITED KINGDOM (GREAT BRITAIN) [svccommitments] => 1 - 3 business days [svcdescription] =>...

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

CakePHP w/ ACL: Best practice for many groups is routing?

I'm working on an app that will have 6 ARO groups in order to cover the required permissions spectrum. It is really best practice to have *_add, *_edit, *_index, *_view, etc. methods for each? That seems like a bit of code overload and maintenance headache. The "cheapest" way I can imagine to handle it with routing is something like: ...

converting simple query to cake query ?

Hi , actually i have 1 query but i am unable to convert it into cakephp query format. $result = "select * from esl_userresults,esl_lyrics where esl_userresults.esl_songID = esl_lyrics.id and esl_lyrics.song_name like '%".$esl_keyword."%'" ; Please help thanks ...

cakephp: send output to browser while executing a process/function.

Hello friends, How can i make a progress bar in cakephp? and other related question is, lets say, for a loop, how can I send output to the browser for every iteration..... in cakephp.... I tried using setflash function, but didnt worked for me.... My main intention in trying above things, is that I want to send some output to browser...

how to display multi table data in one page like facebook news feed

how to display multi table data in one page like facebook news feed. example tables /event,task/ i want to sort by datetime new in top.i can do it by php.i need mysql way /Sorry for my english/ event.row1 task.row1 event.row2 task.row2 event.row3 task.row3 ... older ...

How can i convert this simple query to cakephp ?

Hi , actually i have 1 query but i am unable to convert it into cakephp query format. $result = "select * from esl_userresults,esl_lyrics where esl_userresults.esl_songID = esl_lyrics.id and esl_lyrics.song_name like '%".$esl_keyword."%'" ; when i convert this query into cakephp it gives error like esl_userresults.esl_songID unknown co...

cakephp takes me to login page on multiple request

hello friends, On my cakephp based site, when i do multiple requests simultaneously, cakephp logs me out. What happens exactly is, I click on one of the link on my site, to open it in a new tab, now, while the request is being processed, if i click another link on my site, cakephp takes me to the login page for this link... What ca...

Do I need to specify foreign keys in my mySql script or do I just do this in my CakePHP models?

I'm just starting out with CakePHP. From what I've been reading, by following convention in your model files, it can figure out foreign keys for you. Does this mean that when I'm writing my SQL script to create tables in MySql I shouldn't specify relationships and just let Cake do this? ...

Code separation in cakePHP

Hi, I am developing an application in cakePHP which has two sets of methods : 1) Methods which are called from the mobile phone to process payments 2) Methods which handle the website logic. Now, the problem is that both the methods handling the mobile calls and the website logic are present in the same controller. This has made my cod...

cakephp - why do some changes NOT happen until I switch debugging to 3?

Sometime I will implement changes locally and they work fine, I copy them to my remote webserver and the changed are ignored. (The code is identical.) I go into core.php, change debugging to 3, check again... it works! I have a feeling it's something to do with cache but I don't know what exactly to change. ...