cakephp

where to store large static array in MVC structure?

I have a long php array which I loop through and create a form with. I am going to create a YAML file for it, for ease of maintenance. My problem is I don't know where the appropriate place is to store this file, and how would i invoke it from the view. ...

CakePHP based project is throwing error saying " return value of new by Reference is Deprecated"

I have upgraded my Xampp to newer version(1.7.2).But right now when I run my project(done in CakePHP) it is throwing bug saying Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 99 Deprecated: Assigning the return value of new by reference is deprecated in...

CakePHP and Kerberos

I have a web app built upon CakePHP. Currently it is doing user authentication / Access Control with the built-in AuthComponent and the ACL functionality. Throughout our organization, we have MANY applications (web and otherwise) that all require their own user/pass combo. Our company is looking to migrate as many of our internal apps...

Order By Sum of Two Fields

Let's say I have a table with karma_up and karma_down. Everytime someone votes up karma_up gets incremented and everytime someone votes down karma_down gets incremented one as well. How can I pull these a selection of rows and have them ordered by the sum of these new values? ORDER BY (karma_up - karma_down) does not seem to work how ...

How to deploy authorization between multiple cakephp applications?

I have main site example.com where users can register and login or just login with openid. Logged in users can create their own sites with subdomains like mysite.example.com. Every user can have multiple sites. Every site is cakephp app. Every cake app has its own ACL. How do I deploy authorization so users logged in to the main site, a...

Advantages of a framework with strong naming conventions

Hi There I know some PHP and now I'm the stage of choosing a framework. After some diggs, I've find that CakePhp is a good choice. After some manual/tutorial readings and trying some cakephp code samples I'm wondering myself about how good is the idea of naming convention used by CakePHP. They are using the term: "convention over conf...

CakePHP - basic hasAndBelongsToMany problem

I'm just learning CakePHP, my simple app links two tables with a hasAndBelongsToMany relationship. I was expecting that the scaffolding would enable me to associate posts with tags but it doesn't. Here is the code: SQL CREATE TABLE `posts` ( `id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT , `content` TEXT, PRIMARY KEY ( `id` ) ); C...

CakePHP: Clearing password field on failed submission

Greetings, I am setting up a pretty standard registration form with password field. The problem is, after a failed submission (due to empty field, incorrect format etc), the controller reloads the registration page, but with the password field containing the hashed value of the previously entered password. How do I make it empty after ...

CakePHP integration with ExtJS 3

Hello, I am a PHP and ExtJS user. I am looking into developing an application using a good PHP framework (CakePHP; good as in "I consider this good for me") and ExtJS version 3. What I would like to achieve is a complete Ext viewport with many grids and functions that would call PHP urls for retrieving data, saving data, edit/remove data...

How to convert mysql table data to Excel or CSV format in CakePHP?

Hi, I want to convert my sql data to csv files while clicking on a button. The code fragments I found for sql to CSV conversion were in PHP, and I'm trying to convert it to CakePHP since I'm working in CakePHP. Here is the PHP code I'm tring to convert: $result = mysql_query("SHOW COLUMNS FROM ".$table.""); $i = 0; if (mysql_num_rows($...

how to Redirect to another controller

Hi, in my application am calling this line in case a particular case (if condition) from ajax call $this->redirect('/login/login/'); But this was updating the particular div. I want to redirect the whole page. How to do it? Thanks, ...

Multiple Counts in CakePHP

I have a PHP application using CakePHP. I need to present a table showing the count of particular events for each day of the month. Each event is record in the DB with a name and a Data. What is the best way to create a table for this, do I really need to do 31 SQL calls to count the events for each day, or take out the data for the whol...

Cakephp change URL behaviour

Hi, We are developing a site using CakePHP. We have a windows IIS server (shared hosting) with PHP5, that does not support .htaccess or mod_rewrite but still we have the site up and running and developed a lot of things. The current URL structure is something like this: mydomain/index.php/user/add We want to change this to something l...

For loop problem in JQuery

Hi, I am using JQuery where i am trying to use the Cakephp Controller returned values in the JQuery input element.. I have two variables returned from my CakePHP controller action $entries and $attributes.. $attributes will return the Fieldname and its type,size $entries will return the Fieldname and the value submitted for the Fiel...

Retrieve first key in multi-dimensional array using PHP

I would like to retrieve the first key from this multi-dimensional array. Array ( [User] => Array ( [id] => 2 [firstname] => first [lastname] => last [phone] => 123-1456 [email] => [website] => [group_id] => 1 [company_id] => 1 ...

CakePHP Model with "Between dates"

I have a large data set (over a billion rows). The data is partitioned in the database by date. As such, my query tool MUST specify an SQL between clause on every query, or it will have to scan every partition.. and well, it'll timeout before it ever comes back. So.. my question is, the field in the database thats partitioned is a dat...

What is a .ctp file used for in CakePhp?

Hi all, I'm starting to use cakePhp, and in the process of reading the manual. About halfway down the page, there's this comment: // Render the element in /views/elements/ajaxreturn.ctp So a very simple question: what's the .ctp extension refer to? What's the general use case? Thanks. ...

Accessing Associations in a View with CakePHP

Sorry if this question is too vague, but I'd rather not muddy it's point with my assumptions as to what may or may not actually be relevant background information. If I create an association such as Employee belongsTo Company When I create a view for Employee and want to display their Company name how can I simply display the company n...

cakephp .htaccess, mime-types

I have a cakephp 1.2 app (1.2.2.8120) and I am trying to change the mime-type for Japanese cell phones on certain pages with this one line of code in the app/webroot/.htaccess file: AddType application/xhtml+xml .xhtml This works for .xhtml files uploaded directly to the webroot folder, but regular cakephp pages don't work. I have tri...

.htaccess for cakephp

I'm trying to get a CakePHP application to work. For this, I've set up a brand new Debian installation, updated the configuration and put everything in /var/www, which has the following content: app cake .htaccess index.php vendors The .htaccess file contains the following: <IfModule mod_rewrite.c> RewriteEngine on RewriteRul...