cakephp

How to scaffold table with tree behaviorin Cake?

Is it possible to scaffold a table in CakePHP 1.3 that has the awesome tree behavior? It seems not to be supported out of the box, I'm looking for a very simple CRUD admin interface. ...

cakephp paginate using mysql SQL_CALC_FOUND_ROWS

I'm trying to make Cakephp paginate take advantage of the SQL_CALC_FOUND_ROWS feature in mysql to return a count of total rows while using LIMIT. Hopefully, this can eliminate the double query of paginateCount(), then paginate(). http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows I've put this in my...

CakePHP Auth how to allow specific controller and actions

I have a "Posts" and a "Users" controller. I use the Auth Component and I want that all users can visit "Post.index" but only logged in users can visit "User.index". In my app_controller.php I have this $this->Auth->allow('signup', 'confirm', 'index'); but with that all users can visit post.index and user.index. How can I specify a ...

Where can I get full applications written in CakePHP?

I'm trying to master CakePHP and I figured one way to improve my code is to read other apps. I'm wondering, where can I find well written apps made with CakePHP? Thanks in advance! ...

how to write web services using cakephp

Is it possible to write web services in CakePHP? any sample tutorial? ...

How to set form name and id using cakephp FormHelper class?

I'm trying to create a form using Cakephp's FormHelper class. The form needs to have a name and and an id. I fail to see an option for that however. Looking at the documentation for the Formhelper, I see a lot of things, but not a way to set name and option. It's not in the source for the Formhelper either. How are these values set...

Model relationship types in cakePhP

I have checked out the cookbook web site of cakephp that there are four types Model relationship: http://book.cakephp.org/view/79/Relationship-Types Since the one I am more familiar with is belongsTo, I am not sure when I need to use hasManay and HABTM. What will be the result to my web site if I used a wrong Model relationship type? ...

Naming convention for the primary key in a Table

Hi all, I am learning the Model relationship types in cakephp. I have built two tables and in one of the Table A, I got these fields in it: Table A {postID, topic, content} Table B {replyID, content, postID} And when I ran the web page, a bunch of error related to SQL popped up saying that cakephp couldn't find post_id. It is weir...

Write a few things to a session in cakephp

Hi all, I am learning Session function in CakePhp, and see some examples like this on cakePHP cookBook web site: For example: write($mysession1, 'testing') I am not sure if a session can only hold up a particular thing in it. Is it possible to write an array to a session like: mysession[0] = 'Testing0'; mysession[1] = 'Testing1'; m...

[Locale] Switch between different languages interface in cakePhp

Hi all, I am learning the locale function in Cakephp. I am not sure how to design my own locale files so that users can switch between Spanish and English in my web sites. Please advise. ...

Creating a RESTful service in CakePHP

I'm attempting to create a RESTful service in CakePHP but I've hit a bit of a brick wall. I've enabled the default RESTful routing using Router::mapResources('users') and Router::parseExtensions(). This works well if I make a GET request, and returns some nicely formatted XML. So far so good. The problem is if I want to make a POST or ...

What are the possible reasons for App::import() not working?

I'm trying to implement a simple way to manage static pages in CakePhp, as described in this article. The problem I'm facing is that App::import() doesn't seem to import the required class in the routes.php file. The code is the following: App::import('Model','StaticPage'); $page = new StaticPage(); $slugs = $page->find('list', array...

How extensive is an Object in CakePHP model linkage?

I was hoping someone with an understanding on CakePHP could shed some light on a question I've been having. Here's my scenario, I have a User this User has a Company which in turn has many Department and many Address. If I were to get a User could I expect to have access to the Company and all models associated with that Company? So wo...

CakePHP: saveAll with hasOne plus a HABTM

Hello everyone. I have two models set up that I need to save inside one form. When the user uses the "/deliveries/add/" form, I need it to save a new delivery, and also save a new license that is attached to that delivery. This is a hasOne relationship. Delivery belongsTo License License hasOne Delivery Also in the same form, I need...

How can I by using the FormHelper ,or some other method, render an image link that runs javascript when clicked?

Background: I want to render this: <a href="javascript:myfunction('Somevar')"><img src="some.png" width="20" height="20" border="0" /></a> in a cakephp app. Note: this link is not associated with a model at all, it's just part of a form going off-site. I'm unsure of how to proceed: I've seen this on the cakephp site, but with a...

Cakephp doesn't write a cookie

Hello! I have a problem with writing cookies in cakephp and even don't know how to debug it or where too look for a clue. I've inherited a project where cookie were only created using the Session component, of course i added 'Cookie' to $components array in app_controller and put this in beforeFilter: $this->Cookie->name = 'foo'; $this...

Migrating custom coded/developed php project to CAKE php framework

Hi all, My client wants to Migrating their custom developed php project to cake php framework. But, as of now i have only a bit of knowledge in CAKE. can anyone please let me know where do i get started CAKE php. i have already installed CAKE in my system ...

CakePHP update multiple elements in one div

The idea is that I've 3 ajax links and each link is coupled to one single element (a form). The element will be loaded in one div. Each time when you click on a different link, the element that is requested before must be removed and the new one must come in there. So it has to update the DIV. The problem is, that it request the element,...

different methods in passing parameters in Cakephp

Hi all, I am using cakephp v1.26. I got a function in a controller like this: class testingsController extends AppController{ function testing($id=null){ $recieved = $id;} } I am not sure if there are any better ways to pass a parameter to the Action testing. But I have come across some web sites and got these two methods. Is there...

Trouble with Router::url() when using named parameters

I'm generating plain simple links with CakePHP's HtmlHelper the following way: $html->link("Newest", array( 'controller' => 'posts', 'action' => 'listView', 'page'=> 1, 'sort'=>'Question.created', 'direction'=>'desc', )); Having the following route rule: Router::connect(...