cakephp

CakePHP 1.2.6 - TreeBehavior Issue with Bad Nodes

I've got a Pages model that I'm using the TreeBehavior for a hierarchy. I'm building a breadcrumb trail based on the Page model hierarchy. I'm having issues, though, with the breadcrumbs coming through incorrectly and reporting the wrong parents. It seems that every time I call verify(), I get this sort of result: [0] => Array ( ...

CakePHP Smarty View with theming support (i.e. Themed Smarty View)

Hi folks, I use Smarty View, but want to benefit from theme options. Since for theming cake use Theme View, I cant use both Smarty and Theme at the same time. Perhaps can combine the code but am not that familar with View eingine core. Already have a lot views done with smarty and do not want to recreate all of them with plain php. Is ...

How to return id of a submitted form using Prototype?

I have a page that has several ajax submission forms. Each form has a dynamic id assigned to it when it's written to the page. Does anyone know if there is an easy way to return the id of the form that is being submitted? I'm basically looking to click "submit" and alert the id of the submitted form. From there I can use it in the ajax o...

CakePHP: Missing database table

I have a CakePHP application that is running fine locally. I uploaded it to a production server and the first page that uses a database connection gives the "Missing Database Table" error. When I look at the controller dump, it's complaining about the first table. I've tried a variety of things to fix this problem, with no luck: I've ...

Why is my .htaccess file redirecting to full server path instead of relative path?

I've never had a problem with cakePHP before, but something's odd about this server and is causing the redirects in the .htaccess files to behave oddly. CakePHP uses mod_rewrite in .htaccess files to redirect requests to its own webroot folder. The problem is that the redirects are listing the wrong path and causing a 404 error. My Cake...

Cakephp 1.3, router and authentication problem

Trying to implements simple privileges for admin user. Don't need huge acl rules and groups system. There are admin users, overs - just registered users. They can't access actions with admin prefix. So It was implemented in cakephp1.2 version with following code in app_controller: function isAuthorized() { if (isset($this->params[Co...

My choice of fieldname for CakePHP's form helper is not working properly, why?

Hi, I'm creating an AJAX form. The problem is when I'm trying to create a input form with formhelper, my input's name attribute is not correctly renedered in the view. Here's my code: $form->input('MainAttribute.'.$i.'.SubAttribute.'.$j.'.score', array('label' => '', 'options' => $scores)); I created it that way because I want SubAttr...

CakePHP ACL - Do I need to add all my users to ARO ?

I have a users table and also have a column for role. Added the roles in ARO. the command : cake acl view aro shows 1 role1 2 role2 3 role3 Me confused about creating ACO. Should I add all my users to ARO ? Thanks ...

cakephp association error?

Warning (512): Model "User" is not associated with model "User" [CORE\cake\libs\model\behaviors\containable.php, line 340] im getting this error when accessing datas of photo, friend user has many photos and friend, photos and friend belongs to user in photos index page, two warnings one for user mentioned above and other for 'Friend' ...

Book/tutorial that teaches how to make programs that are easy to maintain and are less coupled?

Hi, I'm a PHP programmer and I really want to increase the quality of my code and most importantly I want to be better at programming. What book, tutorial or article would you guys suggest that I read that teaches how to make programs that are less coupled and easy to maintain? Are there any specific tips for PHP especially for the Cake...

How do you work in team?

I always designed/developed/released a software or web project myself/independent activity using java/vb.net and php (intermediate level of experience). But recently i have to work in a company with team of 5+ using Zend or Cakephp. Q. My question is how do you work using php frameworks in team and all those SVN staffs? 10 ppls will m...

[CakePHP] Showing first element of the array

How can I find and show Name of first element in a table? I'm guessing that I have to use something like $this->data['lastInvioce'] = $this->Invoice->find('all', array('limit' => 1)); ... in controller to find it... Tnx in adv!!! ...

CakePHP: How do I order results based on a 2-level deep association model?

I'm hoping I won't need to resort to custom queries. A related question would be: how do I retrieve data so that if an associated model is empty, no record is retrieved at all, as opposed to an empty array for an associated model? As an oversimplified example, say I have the following models: City --> Street --> House How do I sort Ci...

Deployment with CakePhp

Hi all, I have a CakePhp Website that is currently live. I would like to keep working on the site, without impacting the deployed site. What is the best way to keep a production version separate from a deployed version, and then merging the two when appropriate? Currently, I am using Git for version control. Thanks! ...

CakePHP form submission with friendly URLs

Hey! I have to rewrite a form in a CakePHP application. The form searches a list of car sale ads and is pretty complex (~10 fields: model, manufacturer, fuel type etc.). Currently, the form is sent via POST and is working quite well. The problem is I need to create bookmarkable URLs from the search queries and I was wondering what was t...

Losing sessions with window.open and cakephp redirection in PHP with cakephp

Hi guys, Ok, here goes a very strange problem... Our team is using cakephp to develop a large application. Everything session related is working properly so far. The only issues we've had so far are related to iframes and opening windows in other subdomains. I'll explain: User opens up site A and logs into it, creation a User in...

Inventory count in CakePHP

We are developing an inventory tracking system. Basically we've got an order table in which orders are placed. When an order is payed, the status changes from 0 to 1. This table has multiple children in another table order_items. This is the main structure. CREATE TABLE order( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, user_id...

Cookie not renewing/overwriting in IE

I have a weird quirk with cookies in IE. When a user logs into the site, I'm generating a new session id and hence need to overwrite the cookie. The flow is basically: Client goes to https://secure.example.com/users/login page, automatically receiving a session id Client POSTs login credentials to same address Client receives the follo...

PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django

I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although I have pretty good ...

CakePHP - Paginate / Query: find lowest of multiple fields & order by it

I am using CakePHP for a price-comparison website. I have a table products with fields: id, pride_regular, price_action. I would like to combine the fields price_regular and price_action into a dynamic field: price. The lowest value of these two fields should be the value of the new price field. Also I want to order on it Ascending. S...