cakephp

Outputting a hyperlink from a controller in cakePHP

Hi I'm just getting started with cakePHP, and things aren't going so well so far. I have a controller that handles confirming user emails. On registration the user is sent an email with a confirmcode in a link. Depending on the confirm code they give, the controller gives different text responses. One of these responses includes a hype...

One form two action

Hi i have a few form fields i want the on click of button a the control to be sent to action 1 but on click of button 2 it has to be sent to action 2. Currently i am using js to change the form action dynamically on click. but is there any other solution. I cant do the checking after submit in a same method thet have to be two different...

Is it possible to 'deport' an imported controller in CakePHP?

I'm running into a problem with GroupsController::build_acl()- http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs It's taken me a while to track down the bug and now I've found it I'm not sure how to work around it. Symptoms: Not all methods for NodesController (defined by me) are returned. Probable reason: build_a...

How to cache Cake generated XML files?

Hi, This is specifically about CakePHP's caching system. It seems to work fine caching view files, but not for xml files. This is the file I want to cache: /views/thing/xml/config.ctp It is being called like this: http://website.com/thing/config.xml This is the class I have: class ThingController extends AppController{ pub...

Forcing left join on my simple inner join query

The site is already built from years. I am doing some modifications to it. It has controllers "Posts" and "Topics". On the topics page all recent posts are displayed. So it is a simple find of posts from "Posts" table. The fetch is not all assiciated to topic as we are showing all "Posts" and not "Topic" specific "Posts". In Topics cont...

cakephp validation response returning data to controller

Hi i have made a custom validation in the model. How can i access the result($visitor) from this in the controller? model: <?php class Visitors extends AppModel { var $name = 'Visitors'; var $validate = array( 'xxx' => array( 'rule' => array('checkxxx'), 'message' => 'yyy.' ) );...

Cakephp how to reduce number of rows displayed with the Multiple Select

I have a HABTM relation and when i use the following code. the Multiple Select is pretty long in size. i wanna know how to reduce the size. <label for="checkbox">Cuisines:</label> <?php echo $this->Form->input('Cuisine', array('label' => false, 'div'=> false, 'class' => 'short')); ?> I am not finding any option to reduce thi...

Missing Table with Simpletest in CakePHP reloaded

Hey, the solution given here: http://stackoverflow.com/questions/693071/missing-table-with-simpletest-in-cakephp used to work for me. But now I'm facing weird problems like empty DESCRIBE statements: Query: DESCRIBE Query: DESCRIBE Query: DESCRIBE Query: SELECT UserDatum.nome FROM AS UserDatum WHERE user_type_id IS NULL ORDER BY no...

Cakephp model relation

I have two tables user and location user has id(primary) and location fields/columns location has id(primary) and city column Now i wish to relate the two tables by user.location with location.city How can i do it considring city is not a primary key but is unique. I am using cakephp 1.2. Also in mysql can i relate/join tables wit...

Type of string escape done defaultly by cakePHP

Does cakePHP use mysql_real_escape_string for sql data and strip_tags and html encode by default or should it be done by the user/programmer? ...

cakePHP: Overload Sanitize

In the recent cakePHP 1.3.4 version I discovered that Sanitize::html returns double encoded html entities - because of the newly added fourth parameter of htmlentities 'double_encode'. Here is a corresponding ticket on cakePHP: http://cakephp.lighthouseapp.com/projects/42648/tickets/1152-sanitizehtml-needs-double_encode-parameter-in-htm...

Patterns for caching related data

I'm currently developing the foundation of a social platform, and looking for ways to optimize performance. My setup is based on the CakePHP framework, but I believe my question is relevant to any technology stack, as it relates to data caching. Let's take a typical post-author relation, which is represented by 2 tables in my db. When I...

CakePHP 1.3 RSS Helper

I went through the Book and I've copied code from the section http://book.cakephp.org/view/1460/RSS but can't get this to work: I end up with a zero byte file (index.rss) being offered for download by my broswer, instead of xml output. I have narrowed the error down to this piece of code (in app/views/posts/rss/index.ctp): $postLink = ...

Submitting current timestamp in cakephp

What is the method to submit a current timestamp directly on an insert or an update. If I were running regular sql, I would use the function NOW() for the specific sql field on submission. How would I do that with cakephp. $this->Model->save($this->data) ...

2 selectboxes one for updating the other onclick cakephp

Hello, I have a form callled "Project", it contains a selectbox with the names of the companies , the other selectbox is hidden and is called "Staff" and is to be made visible and filled with the names and ids of users that are working for the selected company. >>selectbox "Company" visible | >>selectbox "Staff" hidden -----------...

Help with CakePHP Model Relationships

Three simple tables... Feedname (eg. News or Events) which are the names of RSS feeds. Posts that belong to a Feedname User, that owns all the posts I want to use the Form helper to automatically give me a select box so that when I add a post I can select which Feedname to assign it to. It seems like posts belong to both Feedname an...

cakephp .htacccess with multiple domains

I have my cakephp .htaccess files set up as in the cookbook and everything is working fine. My web site currently has multiple domains, all of which point to the same site (e.g. www.site.com, www.site.co.uk). I'd like to set up a rule so that requests to www.site.co.uk/page are permanently redirected to www.site.com/page, etc. I'm havi...

Using find and null while OR'ing other values

I would like to filter certain fields in my database which are Null, 0, or ''. Unfortunately, using NULL in an IN condition fails to return anything...I believe this is due to NULL comparisons in SQL evaluating as UNKNOWN. For example: $filterField = $this->Model->find('list', array( 'fields' => array('id','name'), 'recursive'...

Cakephp Dynamically add Drop down menus for Time

I have a form which includes adding operting time for a restaurant. operation_hours(weekday, open_time, close_time, restaurant_id) i use this in the form <div class="operation_hours"> <?php echo $this->Form->dateTime('RestaurantOperationHour.open_time', false, '12', null, array('interval' => 15, 'value' => '10:00:00')); ?> <?php echo...

cakephp saving other model data

I have two models Rest (id, name .....) Operating_hours(id, open, close, rest_id) when i try to save a record from Restaurant add form. it saves only open and close time but not the reference id at rest_id. $this->Restaurant->create(); if($this->Restaurant->saveAll($this->data, array('validate' => 'first'))) { ...