cakephp

CakePHP - how to give public authorization on the main page

I set up the basic Authentication/Authorization set up, but a problem now is that every time I try to access the http://localhost:1234/, it requires user to login. How/Where do I make the Auth->authorize("index") on the main page? ...

cakephp - session variable keeps acting strangely

For reasons that elude me, a session variable that contains the customer's name will show up for a short while, and then disappear. In the app_controller.php : beforeFilter() if (isset($_SESSION['customer_name']) == false || strlen($_SESSION['customer_name']) == 0) { $customer = $this->Customer->read(null, $auth['User']['custo...

In CakePHP, what is a good way to exit or return from controller's methods?

In methods of controllers, there are usually many checks for "doing the right thing". For instance, I check if user is accessing the right data. However, I'm wondering what is the best way to return or exit from these methods when errors do occur. I've been using just simple return statement, but is there anything that's more CakePHP-li...

Handling multiple URL values in CakePHP

I'm developing a site using the CakePHP framework. I have a form which shows a list of entities, with a tickbox for each one allowing you to select it. You then press a button at the bottom of the form saying "Edit selected". My usual approach is to give each checkbox input the same name (e.g. row_id) and use the primary ID as the input...

Retrieve Values From the Controller in JQuery

Hi, I m new to Jquery..How to retrieve the values from my controller and compare them with some String inside JQuery..Please suggest me.. $(".select"+increment).change(function () { if("here i need the value from my controller " =='String') { $("<label id=labelstr"+stringinc+" >"+labe...

Modelling Users, Groups, Portfolios and Media using an MVC Approach

I am creating a simple design for a social-networking site using the MVC paradigm(in CakePHP) for a project, I have a table called Users which stores all the User Details, I have a Groups Table which stores all the Group details, the relation between these 2 models is has and belongs to many, then I have a group_portfolios table which st...

assigning options for ajax in cakePHP

I have an ajax->autoComplete working dandy with cakePHP. Now I want to add my own javascript (preferably callback methods) after the request has been executed. I know that there are options associated with the ajaxHelper but I cannot figure out for the life of me how to apply them to the autoComplete function. I can get ajax->autoComple...

Validating User Data based on Controller Names

I'm building a CakePHP site for a client and I've got a bit of an interesting problem. They want to add a new feature whereby users can create their own landing pages within the site using this type of URL: http://mainsite.com/username. Since this is a Cake site, there are plenty of values for username that would result in all sorts of...

Sending arrays to REST services in CakePHP

Hello, I'm currently writing a REST service using CakePHP and I was wondering how can I send an array of item_ids through REST to an action. class ItemsController extends AppController { var $components = array('RequestHandler'); var $helpers = array('Text', 'Xml'); function index() { } function create($itemsArr) { //handle...

Should I use a framework or write my own MVC?

I have a project that is currently all over the place and i'm thinking of making it MVC. The problem is that the system is currently being used and I can not change the interface (It's in frames :s) Also there are certain things that I will need to handle myself such as password generation, login and user levels. I already have the mod...

MySQL Query Logging in CakePHP

Hello, I wanted to know if there is way to log the mysql queries in CakePHP being executed when we use the find method on the models, I know that rails database queries, so does Cake do the same, if so how can I enable it or use it? Shiv ...

CakePhp Find

Hi, can anyone tell me what is the best way to do something like, from a db as Table 1 -id -data -foreign_key_id_table2 Table 2 -id -data -foreign_key_id_table3 Table 3 -id -data I need to select all items of table one linked to all items in table 2 of a given table 3 entry something like select table1.data from table1 where table1...

path error in jquery call to cakephp controller/action

I know, strange title.... this is my problem: I have the cakephp stack in /var/www/site from one view under controller A I do a jquery ajax call: $("#searchstring").autocomplete("/items/getitemsforautocomplete", { ... more code when the call is triggered I can see from firebug that cakephp wants to call: http://localhost/items/g...

In Cakephp, how can I access an array from the whole application.

In CakePHP, how can I make an array we use accessible by the whole application? Is there an equivalent of PHP's define() function? ...

Asynchronous processing or message queues in PHP (CakePHP)

Hi all, I am building a website in CakePHP that processes files uploaded though an XML-RPC API and though a web frontend. Files need to be scanned by ClamAV, thumbnails need to be generated, etcetera. All resource intensive work that takes some time for which the user should not have to wait. So, I am looking into asynchronous processin...

Accessing REMOTE_USER from PHP/CakePHP

I'm developing a CakePHP site for which I've just enabled VAS authentication using a .htaccess file: AuthType VAS AuthVasUseBasic On AuthVasRemoteUserMap local Require valid-user I'd expect to be able to find out who was logged in by using $_SERVER['REMOTE_USER'], but I'm finding that the key is missing from the $_SERVER structure: ...

CakePhp helpers and i18n

Hi, i have some questions about cakephp, i spent long time googling for a solution and as i didn't find any i'm not sure i'm taking the right approach. So, i have a menu/sitemap wich is part static (xml file - i10n) and part dynamic (database i18n) i've been asked to cache the menu so that: A component creates a cache xml file of the...

cakephp - how can I forward data in the controller to another controller?

I have a signup form posting to my customers_controller, but now they want the signup form to take payment information too. I have a payment_controller, After saving the new user I'd like to forward the payment post data to the action in the payment_controller. How do I do that? ...

Unit Testing In CakePHP

Hi, I'm doing unit testing in CakePHP. I want to test two of my controllers. My app has different kinds of users. I want to test the results the app return depending on which type of user is logged in. I don't know, however, how to log in to the app from the controller test case. I tried a couple of approaches without success. 1) I t...

Is there an easy way to get AuthComponent user data from a view in CakePHP?

According to the cakebook section on the Auth component, I can implement simple authentication by using the following Users controller: class UsersController extends AppController { var $name = 'Users'; var $components = array('Auth'); // Not necessary if declared in your app controller /** * The AuthComponent pr...