cakephp

Problem passing URL variables in post form submission with CakePHP FormHelper

Hi there, I'm writing my first CakePHP application and am just writing the second part of a password reset form where a user has received an email containing a link to the site and when they click it they're asked to enter and confirm a new password. The url of the page is like this: /users/reset_password_confirm/23f9a5d7d1a2c952c01af...

CakePHP HABTM: Editing one item casuses HABTM row to get recreated, destroys extra data

I'm having trouble with my HABTM relationship in CakePHP. I have two models like so: Department HABTM Location. One large company has many buildings, and each building provides a limited number of services. Each building also has its own webpage, so in addition to the HABTM relationship itself, each HABTM row also has a url field where ...

How do I pass multiple model IDs into comments add action in CakePHP?

My question concerns how I can use one comments controller with multiple 'belongs to' controllers. I want to add comments to news, posts, and matches (it's a tennis website). I've got the comments add action setup to use the 'ajax' helper and I'm also using counterCache to keep track of the number of comments for each news, post and mat...

CakePHP - HABTM - adding multiple tags to multiple points

I am trying to 'tag' multiple 'points' with multiple tags. I'm tagging my single points successfully. Unfortunately, when i try and use a tag, such as 'test2' on another point as a tag it is either giving me a duplicate entry error if i have my 'unique' set to false or if 'unique' is set to true, it will del my tag for all other points ...

FlashChartHelper for OpenFlashChart2 in CakePHP: blank charts

So I have recently started playing with Ubuntu, PHP, and CakePHP and have been pretty happy with the LAMP stack. Except now I'm trying to build a simple web page that can display collected data in a graph. Apparently OpenFlashChart2 with the FlashChartHelper plugin is pretty good, but I cannot get it to actually display a graph. I got...

Where to put certain logic in CakePHP

I've recently started to rewrite a project I did a few years ago using CakePHP. I'm trying to do everything 'right' this time, so maybe someone get give me a a pointer on doing to the following: I'm showing a simple table from a table using Model->find('all') in the View. There are two boolean fields in this table, that together make up...

CakePHP: Execute code before some model methods

Right now I have several methods in my model which all fetch the same object at their beginning (the model's parent class). I would like to do this automatically and execute some code beforehand. I would like to say "execute fetchParent() before you call the methods getParentId(), getParentTable() and mayChange()". It it not sufficient...

CakePHP paginate conditions in derived fields

Hello, i would like to paginate a list of games, where the sport is a chosen sport. the relatition is as followed: Game BelongsTo Competition BelongsTo Team BelongsTo sport What i would like to do is show all games where the teams sport_id = 1. The following doesn't work: $this->paginate = array('limit' => 30, 'page' => 1, ...

Cakephp FormHelper not outputting "<form>" tags

Hi, So I have a users controller with an action called "selfView" it looks like this: (*users_controller.php*) function selfView() { $user = $this->User->find('first', array('conditions' => array('User.id' => $this->Auth->user('id')))); $formms = $this->Form->find('all', array('fields' => array('Form.id', 'Form.name'), 'recursive' ...

"Automagic" output fields in CakePHP?

I'm currently using CakePHP's "automagic" field elements for my CRUD forms. By this I mean I'm using the echo $form->input('fieldname', $options); method to generate everything. This chooses the correct element type, and wraps everything into a div with a <label> element. Now I have some fields that are not editable, but i'd like f...

Strtotime error in Cake 1.2.6

PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date. timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still ge tting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_...

cakephp uses old dns entry

Hi, In our cakephp application, we do a file_get_contents('http://my.web.com',... ); Recently we changed the ip address of my.web.com, and we modified our /etc/hosts file, and flush dns cache using /etc/init.d/nscd restart, and restarted apache. However, file_get_contents still refer to the old ip address, while if we do ping, nsl...

CakePHP RESTful actions

I have successfully made my 4 CRUD actions restful by using mapResources in the router config. but I need to filter which ones are actually RESTful. How do I filter which ones are RESTful? I don't want to allow rest calls to the delete actions for example but I do however need to keep the delete action so I can moderate. ...

Linking to assets on a cdn with cakephp

I am getting ready to deploy a cakephp app onto the web and i want to move all the assets (img, js, css) to a CDN to increase performance. Is there a way to globally change the location the HTML helper links to assets instead of having to change every link. ...

What's the most efficient way to get data from a model in CakePHP?

I'm new to CakePHP, and still figuring out the basics. Right now I'm a bit mystified by the process to get one or more fields from a model (from inside another linked model). So far, I have this: $this->user->id = 123; $this->User->read(); $field1 = $this->User->data['User']['field1']; $field2 = $this->User->data['User']['field2']; W...

CakePHP and HABTM Tag Filtering

I am wrestling around a bit with CakePHP HABTM relationships, and I've gotten stuck trying to do a seemingly simple task. I have many Camps and many NewsItems. Each NewsItem could be relevant to any of the camps, so when a user creates a NewsItem, they check which Camps the item is for. That's the idea. So... I would like to incorpo...

CakePHP layout partial?

In my CakePHP application layout I have a section for latest posts that needs to pull from a database. How would I tell it to render a partial so I can pull the latest posts? Sorry if this is a simple question, I just started CakePHP tonight. ...

CakePHP Relationships - How to setup relationship for message system ?

Hi ! I am trying to make a messages functionality similar to the facebook. Just the message thing and not facebook. A brief descriptions does like this. 1) There are a number of users ( user table) 2) One person can send a message to one or more than one person. 3) There can be multiple reply to the same message. 4) If its send to multi...

How to begin learning CakePHP or any other MVC framework

I want to learn some MVC framework. I am trying to learn CakePHP by reading the docs on their website. But I am finding it very difficult to learn it. Can someone suggest a good way to begin learning CakePHP and provide some alternative websites? ...

how to insert multiple rows using cakephp

In the cakePHP project I'm building, I want to insert a defined number of identical records. These will serve as placeholders records that will have additional data added later. Each record will insert the IDs taken from two belongs_to relationships as well as two other string values. What I want to do is be able to enter a value for th...