cakephp

Cakephp getting session variable in model without using Auth component

Hi, I want to get my session variables in my model. Im not using Auth component. Is there any alternate way ? Thanks Binoy ...

CakePHP Controller::persistModel and Form Automagic

I am developing an app using the CakePHP framework. I just recently read an article that said enabling var $persistModel = true; could lead to performance gains. As I am working on a development server I thought I'd give it a try. Lo and behold the site was slightly faster at the cost of losing form automagic. For example, all user...

CakePHP: get user info in models

I'm moving some of my find code inside models. Previously in my controller I had $this->Book->Review->find('first', array( 'conditions' => array( 'Review.book_id' => $id, 'Review.user_id' => $this->Auth->user('id') ) )); so in my Review model I put something like function own($id) { $this->contain(); ...

CakePHP ACL - On the fly permission management?

Greetings! im pretty new to cakePHP and just starting to use the ACL feature. From the outside it looks quite ok, but when i started using it.. well its not that ok anymore :) Im working on an application with an administration backend in which i need to be able to change group permissions on the fly. I tortured google for quite a whil...

Setting up cakePHP on shared host and remove /app/ in URL

Hello, I've installed cakePHP on a shared server where I can't set the Apache webroot, so it's currently pointing to /public_html. In that folder I have /cake, /app, /vendors, etc. Everything works fine; the only problem is that rather than links to controllers/actions being www.mysite.com/controller/action, there is an addition /app/ i...

cakephp habtm relationships with input rather than select box?

I'm creating a form in cakephp that has a typical HABTM relationship. Let's say that I'm developing an order form with a coupon code. From a logic point of view, I need to accept a text-entry for the coupon code, so the incoming data would not be the proper primary key, but rather a different field. I would then need to validate that da...

CakePHP saveAll() function problems

Hi GUys, Im trying to save a record to a table aswell as an accociated record. The main table is called quotes and it has a hasmany link to the table quote_items. quote_items belongsto quote When i try and save it saves the record in quote but does not save the record in quote_items . Below is my quote add function function add(...

ajax->form submit onchage event on selectTag keeping submit button on form without click

Hi, I am using cakephp 1.1. for my project.I used ajax->form for form creation.In one form, form submitted using onchange event of selectTag taking submit button and giving submit.click for that button.But it peroperly not redirect to view file gives error "cake/libs/model/datasources/dbo_source.php" and submit that form,but I am not g...

Add and remove form fields in Cakephp

Hi Guys, Im looking for a way to have a form in cakephp that the user can add and remove form fields before submitting, After having a look around and asking on the cake IRC the answer seems to be to use Jquery but after hours of looking around i cannot work out how to do it. The one example i have of this in cake i found at - http://...

How to rewrite or set the Return-Path in cakePHP Email Component?

I'm using the cakePHP email component for sending mails from my application. Now the return-path has something like [email protected] How can I set or rewrite the Return-Path value in emails when using the cakePHP Component? I know how to do it when sending mails via 'mail' in PHP but the cakePHP email component seems to missing such a fe...

Set included PHP and HTML content to a variable

I am working on a small MVC "framework", which will simply provide a more organized workspace for me, as I've found I love CakePHP but only for it's organization. Now, I'm trying to replicate the layouts (which contain <?php echo $title_for_layout; ?> and <?php echo $content_for_layout; ?>,) and I'm curious how I would be able to load a ...

Sharing cache directory of cakephp on multiple servers

We having been using multiple webservers for our cakephp application, now the problem is there are two cache directories , server 2 is clearing his cache before doing any insertion in his database. BUT server 1 doesn't know the about the database has been changed , so server 1 cached is not cleared When new web request comes to serv...

CakePHP 1.3 (newest), fatal error while baking views

I've just downloaded the newest beta of CakePHP 1.3 for a new project (not a serious one, so no worries with the beta, still learning stuff, I'm right now trying to get grip on acl/auth). I've baked model and controllers for four databases, but baking a view results in a fatal error: Fatal error: Call to a member function on a non-obje...

When to do sanitization in CakePHP

I read from the cookbook (sec. 4.2) CakePHP already protects you against SQL Injection if you use CakePHP's ORM methods (such as find() and save()) and proper array notation (ie. array('field' => $value)) instead of raw SQL. For sanitization against XSS its generally better to save raw HTML in database without modification and saniti...

Is it possible to use php includes to integrate Mint (haveamint.com) into my CMS?

I am currently running a custom CakePHP CMS and I would like to have a .php page which will basically use php includes for Mint from haveamint.com which is also written in PHP. Can I use php include to basically do a nicer version of an iframe inside my cms? ...

CakePHP: using Security::allowedControllers and Security::allowedActions

I'm trying to use Security::allowedControllers and Security::allowedActions. So I have a controller which look more or less like this class AppController extends Controller { var $components = array('Security'); //other components //other stuff } class BookController extends AppController { function beforeFilter() { ...

Configure Compass within a CakePHP project

I've been looking into Compass and the more I look, the more it feels like the way that CSS should be written. As a test case, I'd like to use it in one of my CakePHP projects. Unfortunately, I'm having some trouble with the initial configuration. Specifically, with getting the resources in the right place and referenced properly in the ...

Dynamic layouts in CakePHP

Sorry about the question title, but I couldn't find a more appropriate way to phrase this. I am currently building a CakePHP powered website and I'm not quite sure how to approach the following issue. The website looks something like the follwing mockup: . The greyed out areas are part of the layout, because their content does not ch...

CakePHP Relationship Question

I am trying to configure CakePHP to act as a REST API for an app i'm writing. I have 3 tables: dishes { id, name, description } users { id, name, email } dishes_users { id, user_id, dish_id } I would like it so that when someone visits /users/1.xml, the data that gets returns is just the list of 'dishes' that a user has in...

How to pass javascript var into a ajax remoteFunction?

I have a view where ill have 3 divs: Div 1: List of Brands with checkboxs. Div 2: List of Categories with checkboxs. Div 3: List of Items. This last div will be refreshed with the all the items according to what is selected in the first two divs. At beginning it shows all the items, after we select some of the brands and/or categories...