cakephp

Where does ASP.NET MVC fall short against Ruby on Rails, CakePHP, et. al.?

I've been working quite extensively with ASP.NET MVC and I find it extremely useful (compared to WebForms), however I have some experience with other MVC frameworks and I feel there are definite gaps in capability. For one, in Drupal you can hook into just about anything and override it's View action. e.g. You can hook into the Drupal f...

CakePHP select default value in SELECT input

Using CakePHP: I have a many-to-one relationship, let's pretend it's many Leafs to Trees. Of course, I baked a form to add a Leaf to a Tree, and you can specify which Tree it is with a drop-down box ( tag) created by the form helper. The only thing is, the SELECT box always defaults to Tree #1, but I would like it to default to the Tr...

Modifying CakePHP-resident Wordpress Redirects using mod_rewrite

I have a CakePHP site that contains a vanilla Wordpress installation. It lives in /app/webroot/blog/. The problem I'm having is a strange one. I have the site configured, through mod rewrite, to redirect all requests to /app/webroot/blog to /blog/. The reason for this is that Wordpress was either throwing errors or displaying no cont...

Development and Production Workflow

I've seen pieces of this problem solved around the net, yet I'm still confused, so I thought I'd ask the smart folks at Stack Overflow about this. We're a small startup and at the moment our workflow from development -> production involves ftp-ing in and just uploading the dev code. The dev code IS under subversion control - although ...

Revision system - Help improve my code

A section of a site I am building needs some form of revision system and so decided to keep it simple and go with one similar to Stack Overflow. I quickly created the following which works although seems a little messy. I know I can use beforeSave and afterSave but I have no idea how I could implement it. I know I could probably move ...

Cache problem in CakePHP

I am using CakePHP and i am getting the following error Warning: Cache not configured properly. Please check Cache::config(); in APP/config/core.php in D:\PHP-SERVER\cheesecake\cake\libs\configure.php on line 663 Notice: Undefined variable: Route in D:\PHP-SERVER\cheesecake\app\config\routes.php on line 38 Fatal error: Call to a membe...

cakePHP: How to create a form for a 2D/multidimentional table?

Hi, I need to create a form in CakePHP to allow users enter data(numbers) into the cells shown on the table below. The input screen needs look like the table shown below. The users should be able to select any cell they want to enter/update the value, then type in the value, click submit and submit the value/s. Each "Metric section ...

MySQL Inner Query with a Where and Group by conditions in cakephp

Hi, i am having a table named Reports with id report_id user_id 1 1 5 2 1 5 3 1 5 4 2 5 5 2 5 6 3 6 7 3 6 8 4 1 9 4 1 10 4 1 i am trying to write a Query such that user_id = 5 and to find how many reports he has ...

IP Blocking URLs on Apache

I need to block access to my entire site via IP Address except the url /api which should be open to all. I am currently using ... <LocationMatch /admin> Order Deny,Allow Deny from all Allow from [MY IP] </LocationMatch> this blocks access urls starting with /admin. But I want to block all urls except the ones that start /...

Using CakePHP's Email component

Hi! I try to send a simple Email via CakePHP's Email Component. I'm using following code from the cookbook documentation: $this->Email->from = 'Irgendjemand <[email protected]>'; $this->Email->to = 'Irgendjemand Anderes <[email protected]>'; $this->Email->subject = 'Test'; $this->Email->send('Dies ist der ...

PHP Framwork that does Named URLs? (other than Zend Framework)

I really like the named URLs in the Django Framework, and was wondering which of the PHP Frameworks supported such a thing. (I believe Zend Framework does, but please exclude that from your answers, without explanation). For instance, in Django I can name a path like "/items/###" as "item-detail-page", which would point to a View 'func...

CakePHP - Two types of users to authenticate

I would like to have two different registrations/logins in the same application. One for companies and one for employees because registering a company requires different information than registering an employee. Is it possible to use the auth component to achieve two different registrations/logins? ...

jQuery input value undefined after append

Anyone that can help me out will be very much appreciated. I seem to have got myself into a bit of a kerfuffle. I'm trying to assign response data - retrieved from an AJAX request using the jquery.autocomplete plugin - to an input element. I can get the response data back fine, but when I try and insert it into the 'value' attribute, no...

CakePHP - Manipulating data-Attribute in validation process

Hi! I am trying to manipulate the $this->data attribute while performing an advanced validation method. The data seems to be changing, but when it comes to saving, the changes don't apply. My question: Am I able do edit $this->data while performing a validation method? Best regards, Benedikt ...

CakePHP: model-based permissions?

Struggling with a decision on how best to handle Client-level authentication with the following model hierarchy: Client -> Store -> Product (Staff, EquipmentItem, etc.) ...where Client hasMany Stores, Store hasMany Products(hasMany Staff, hasMany EquipmentItem, etc.) I've set up a HABTM relationship between User and Client, which is s...

preg_replace multiple problem

I am trying to replace multiple urls in a pagination element with a new url. The replacement works fine when there is one occurrence of the url i.e. prev and next, but it breaks on breaks on the Pagination Numbers. It brings the first and last number links together. How do I get the preg_replace function realize that there are multiple ...

How flexible is elgg?

I know it has great out-of-the-box features but is it easy to customize? Like when I query stuff from the database or change css layouts. Is it faster to create my own modules for it or just go on and write everything from scratch using frameworks like Cake ...

CakePHP, can't spot the problem in the edit action

I aim to toggle the status number in the contacts table in the contact_status_id field each time a link containing the id of the contact is clicked. The page shows no errors, but the action does not change the number. There is no validation implemented yet. Perhaps a set of fresh eyes can spot a problem? function inbox_toggle_number_st...

Comparing two identical strings returns false in PHP

This one is completely beyond me. I'm trying to compare two strings. When I echo them, they appear to be identical, yet when I compare them with the '==' operator, it returns false. For example, when running the code below on my database. It outputs things like "APPARENTLY Apple does not equal Apple". Can anyone shed any light on this? ...

HABTM-Relation : Create a relation for all other records

Hi! If i want to add a record to TABLE A, is there an efficient way to add a record in the JOIN TABLE for many (or all) records in TABLE B? I try to build a simple task management (in CakePHP). An user adds a task and there will be added a connection to each other user in the same group as the current user. At the moment, I use th...