cakephp

cakePHP data model with multiple foreign keys to same table

Based on cakePHP's data model conventions, to setup a foreign key I would specify a column with the source_table followed by an _id. I have an accounts and an account_messages table. Now the complication arises when I need 2 foreign key references to the same accounts table. Specifically I need to keep track of the account_id in the TO...

CakePHP: Same model, set up per form validation rules?

I have a single model in CakePHP that has multiple forms on different pages of the site that I would like to validate differently even where the field name is the same - I have discovered that you can set 'on' to create|update which has been a handy discovery but I am wondering if there is any other way of explicitly declaring rules base...

an better way to do this code

myarray[] = $my[$addintomtarray] //52 elements for ($k=0; $k <= 12; $k++){ echo $myarray[$k].' '; } echo '<br>'; for ($k=13; $k < 26; $k++){ echo $myarray[$k].' '; } echo '<br>'; for ($k=26; $k < 39; $k++){ echo $myarray[$k].' '; } echo '<br>'; for ($k=39; $k <= 51; $k++){ echo $myarray...

Cakephp, an elegant solution to quantities?

Hi, I have a shopping cart system in Cakephp, this table has all your usual maguffins: user_ids, product_ids, option_lists ect. It also has quantity. I currently have some awful nested loops to check if the record is the same as any in there, if so add one to the quantity. If not add a new cart item. This loop has to check associated ...

Page expiry - PHP/CakePHP and Internet Explorer

Hi guys, I have a search box on my site, whereby the user enters a term and results are displayed. When they click one of the results (a product) they get taken to the product page. When they then hit the back button, they get shown a "Warning: this page has expired" message. I am using CakePHP on Apache, and have been advised that I n...

CakePHP: How can I disable auto-increment on Model.id?

CakePHP 1.3.0, mysqli I have a model, Manifest, whose ID should be the unique number from a printed form. However, with Manifest.id set as the primary key, CakePHP is helping me by setting up auto-increment on the field. Is there a way to flag the field via schema.php and/or elsewhere to disable auto-increment? I need just a plain, o...

Running a Model::find in for loop in cakephp v1.3

Hi all, How can I achieve the following result in cakephp: In my application a Topic is related to category, category is related to city and city is finally related to state in other words: topic belongs to category, category belongs to city , city belongs to state.. Now in the Topic controller's index action I want to find out all t...

Cakephp session is not setting in pages controller

Hi, I am using cakephp1.2 . I have pages_controller which extends app_controller. I have given Session component in app controller . While login from my application, Im setting the session and redirecting to pages controller, but there I could not able to get the session. If I redirect to some other controller, Im getting the session ov...

How to get parameters from the URL to the model in cakePHP?

hi there, let's say i have: http://some-domain/application/controller/action/parameter This is somehow working in cakePHP. Now I want to now what exactly 'parameter' is. But inside the Model. How to get to this information? I have to say that there is a formular including a 'Next' Button and I want to validate the input inside of th...

case sensititivity with users controller on certain hosting

We generally use two different hosting services. On one, everything works ticketyboo, as it does on my local dev servers. On the other server, however, I am having this problem: I can't access the users controller like this: http://www.example.com/users/login But I can like this: http://www.example.com/Users/login ** note the capitali...

cakePHP paginate with post data without sessions, serialization or post to get

I have created a small search and filter form method post in controller/index, which posts to it self the conditions and fields to paginate ( $this->paginate($conditions) ) However that is good for the first page, the subsequent pages the filer conditions are lost. pagination passArgs supports get variables well. Is there an un comple...

update the row using ajax in cakephp

hi to all i am using cakephp in my project. in this at one section i need to update the particular row onclick of the image. using ajax. i used mootools as javascript library. so please help me how could i do this. thanks in advance ...

Are Symphony and CakePHP too slow to be usable?

Until now, I have always said that CakePHP is too bloated and slow. I don't really know that, I just saw "some" benchmarks. What I really want to know, is that if those two frameworks (Symfony and CakePHP) are too slow to be usable in a way that the user will get frustrated. I already know that those frameworks are slower than other alte...

CakePHP: views are blank b/c of wrong caching config

I experienced very strange behaviour with a CakePHP site in production. Some views did not show up, responding with an HTTP code 200 but without any payload. The browser's screen was blank gray. I tracked it down to caching. Deleting the tmp/cache folder helped the first time, but not today. So I turned of caching completly by using ...

Cakephp - how to encrypt and then decrypt data that is being stored and retrieved from the database.

Err.... like the question says. How do I go about encrypting and then decrypting data that is being stored and retrieved from the database. By the way it's not just for storing a password which has been md5ed, I need to retrieve the data too. Thanks! ...

Are Symphony and CakePHP too slow to be usable?

Are Symphony and CakePHP too slow to be usable? Are Symphony and CakePHP too slow to be usable? ...

CakePhp: model recursive associations and find

Hello to everybody! I've some trouble with a find() on a model on CakePhp. I have three model relationed in this way: Project(some_fields, item_id) ------belongsTo-----> Item(some_fields, item_id) ------belongsTo-----> User(some_fields campi, nickname) I need to do a find() and retrieve all fields from project, a field from Item and ...

cakePHP and GROUP BY

I am trying to solve a hopefully simple problem here is the query I am trying produce: SELECT `categories`.*, COUNT(`entities`.id) FROM `categories` LEFT JOIN `entities` ON (`categories`.`id` = `entities`.`category_id`) GROUP BY `categories`.`id` I am really struggling to do this is in cakePHP 1.2 How would/should I go about doing t...

Can I use a specific model from within a behavior in CakePHP?

I'm trying to write a behavior that will give my models access to a simple workflow engine I've devised. The workflow engine itself works as a CakePHP model, with workflow data stored in the database just as any other model data is stored. Basically what I want to do is have the behavior use the workflow model whenever an action is call...

Making a module based social networking cms

What does it take to create a social networking cms like phpfox or socialengine . I am interested in using php / mysql . However , I want it to be modular , like above examples . Like I can enable disable videos from backend . Most important , it should have ability to allow others to extend it , like facebook applications . Shou...