cakephp

HasAndBelongsToMany in CakePHP

I have three Models with the associated properties: Links Model: var $belongsTo = array('LinkCategory'); LinkCategory Model: var $hasMany = array('Link'); var $hasAndBelongsToMany = array('User'); User Model var $hasAndBelongsToMany = array('LinkCategory'); With that, I would expect the following to get me all the link categori...

Help with cake controllers

We had an outsourced engineer work on a quick feature DELETING items listed in our database. He says that the code is difficult because the "controller" is missing. Is there a pre-loaded controller for every function like that in cake, or is it weird that he is expecting a controller to be there for a feature we didn't have yet. ...

Cakephp Insert Ignore Feature?

Is there a way to do an "insert ignore" in cake without using a model->query function? $this->Model->save(array( 'id' => NULL, 'guid' => $guid, 'name' => $name, )); Generates error: Warning (512): SQL Error: 1062: Duplicate entry 'GUID.....' for key 'unique_guid'...

Problem with excluding conditions in complex cakephp model

I'm fairly new to cakephp and I'm having a problem with a complicated find function on my models. I have a number of Groups each containing a number of Users, and each group can make a number of Orders. Each order consists of a number of OrderAmounts which contain an amount and a user_id (relating to a User). I have a find which finds ...

HTTP Digest Authentication Fails With URL Parameters (CakePHP)

I have a RESTful API set up and working with CakePHP using mapResources() and parseExtensions(). Authentication is handled by CakePHP's security component using HTTP Digest Authentication. Everything works fine, unless I add parameters to the url, in the form: http://example.com/locations.xml?distance=4 Which causes the authenticatio...

Multilingual Site - English, Japanese, Korean Languages

Is it that difficult to develop a site that supports 2 byte languages (Japanese, Chinese)? I am planning to develop a multilingual site using PHP. Kindly let me know, if you know some easy methods. ...

[CakePHP] I am so confused. What should I write in the default.ctp

Hi all, I am learning cakePHP, everything seems alright except that I am very confused of how to make use of the default.ctp and what should be put inside the Elements folder. Here is the default.ctp file that I have been using since my very first lesson on learning cakePHP: (I copied from this URL http://book.cakephp.org/view/96/Layou...

Cake PHP Error: Make sure you have created index.ctp (???)

I was just starting to learn cakephp today by going through a "blog tutorial". I created my blog_controller.php and then created a folder named 'blog' with the apps/views/ structure. The next step in the tutorial was to create the index.ctp file within the blog folder under views. In the tutorial it declares that all error messages shoul...

In CakePHP, how do I create a form to list models within a date range?

I have a very simple model that includes the auto-filled field much like 'created'. (DateTime format). I'd like to use the Form helpers if possible, to validate the date fields and whatnot. I'd like a simple form with a "Begin Date" (YMD, 12 hours), and an "End Date" (same format). There is already a controller action set up as fol...

CakePHP - Sorting using HABTM Join Table Field

Hello Cake Gurus, here's my problem: Table1: Posts id - int title - varchar Table2: Categories id - int name - varchar HABTM JoinTable: categories_posts id - int post_id - int category_id - int postorder - int As you can see, the join table contains a field called 'postorder' - This is for ordering the posts in a particular cat...

CakePHP hasAndBelongsToMany (HABTM) Delete Joining Record

I have a HABTM relationship between Users and Locations. Both Models have the appropriate $hasAndBelongsToMany variable set. When I managing User Locations, I want to delete the association between the User and Location, but not the Location. Clearly this Location could belong to other users. I would expect the following code to delete ...

how to use new image folder in cakephp

Hi sir, i am very new in cakephp.i have created a folder in app/webroot/. for image placing. eralier by default img folder cantain image. which i have used some thing like this " image('foldopen.png',array('width'=>14,'height'=>'10','alt'=>'open'));?> " now i have created new image folder insted of img folder. how to use this. please h...

how to create form in cake php

I am very new in cake php, i want to know how to create form in cake php,please describe,when we go to create a form then what i have to do,like create model and controller everything ...

Change find() type of contained model or array transformation

I have the following model associations: Response->Survey Response->Question Response->Choice Survey->Question Question->Choice I want to create a form where I could answer all the questions for one survey. So I used the following to return the needed data: $questions = $this->Response->Question->find('all', array( 'conditions' =...

Display a MYSQL field using CAKE

I am trying to display a field in our users table on the users profile. The field is "rating" we want the 2-3 digit number to appear next to the gravatar. We have a "Rating" table in our mysql db. I want to display this number on our user profile page. JUST BELOW THE GRAVATAR. here is the code in app/views/user/view.ctp <div class="nh...

Fields in CakePHP could not be referred by JQuery

Hi all, I have got a simple HTMl form with one field as follows: <input type="text" name="data['User']['user_id']" id="data['User']['user_id']" value="1"> $(document).ready(function(){ $("#data['User']['user_id']").mouseover(function(){ alert("hello"); }); }); The code couldn't work, I think it may be the name of the Input text ...

How do I secure all the admin actions in all controllers in cakePHP

Hello Everyone, I am developing an application using cakePHP v 1.3 on windows (XAMPP). Most of the controllers are baked with the admin routing enabled. I want to secure the admin actions of every controller with a login page. How can I do this without repeating much ? One solution to the problem is that "I check for login information ...

What is the difference?

I try out CakePHP. I follow this Tutorial and can't find out why this code doesn't work. The code from the tutorial works fine. echo $html -> link('Löschen', array('action' => 'delete', 'id' => $post['Post']['id']), null, 'Sind Sie sicher?' ); ...

cakephp droplist/form - xml and ajax

Hello- I'm complete noob in Cakephp - here goes... I have a website set up with Cakephp framework. I would like to create two dropdown forms to compare/show data. When the user selects an item from the dropdown from either one of the forms it is to show the content below on website. I was thinking this data would need to be stored in ...

which javascript framework is better for Cakephp

hi to all i am using cakephp framework for my project. but i am in confusion that which javascript framework i use for the project. so please suggest me for this through which i get enough help from net. thanks in advance ...