cakephp

select SUM in Cake

When I tried using follow code to get the sum of the column named Serviceinfo.services $conditions = array('fields'=>array('SUM(Serviceinfo.services) as servicecount'),'conditions'=>array('time_id BETWEEN ? AND ?'=>array($startid,$endtid))); $services = $this->Serviceinfo->find('all',$conditions); I had to fetch the sum data with serv...

cakephp COUNT items per month in a year

How do you use cakephp to count, for example the number of posts, made every month in a year? Preferably using Model->find('count') and get the data in an array. ...

Creating 'select' listboxes using FormHelper in CakePHP

I have two models Category and Point. The associations are defined as: Category hasMany Point Point belongsTo Category I would like, when adding Points to my database, to be able to select the category it belongs to from a <select> box, along with the rest of the form data. Where would i need to set the category list and how could i ...

CakePHP how to share session with Vbulletin

how to put folder of vbulletin and modify .htaccess file in cake PHP in purpose use them in same session ? if it possible, plz help me by post the way to put the folder vbulletin in order request access from localhost/forum or localhost/app_name/forum? I am tried to install vbullentin in webroot and modify .htaccess. It can access from...

using localization in cakephp

How can I localize strings in cakePhp? I havent had any success with the online documentation. Thanks for any help. ...

learning OO with PHP

Hi there I've started to learn OO programming, but using the PHP language with the help of the "PHP 5 Objects, Patterns, and Practice" book. The thing is that I wish to learn to use into same time the CakePHP framework which make use a lot of the MVC pattern. Because I don't know much about OO and less about MVC I wish to understand the...

Access $Sesssion from helper in cakephp

hello folks. a cakePHP newbie here.... I have created a custom helper. I need to get a session value in this helper and i need to get some data from a table. How i can make these things possible. I have tried var $helper=array('Session'); but then also when i use $this->Session->read('userid'); it returns error Undefined pr...

CakePHP, CodeIgniter or Rails for multi-user Tumblr clone?

I'm about to start building a tumblr clone that handles multiple users (so premade clones like Gelato won't cut it) and I'm not sure which framework I'd like to build this is. Right now, I'm only intending to build a prototype. Something I can get a dozen friends on to test the concept and grow to maybe a couple hundred users to prove ...

Cakephp with underscore table ignores model

Hi, I have one table metrics and another table metric_levels. In the Metric model I have $hasMany = 'MetricLevels' but anything inside the MetricLevels model is totally ignored. But, if I rename the model to 'Metric' and have $useTable = 'metric_levels' it works fine. I've tried all combinations, but none seem to work. I've tried plura...

How do I completely disable caching in Cakephp?

So I opened the cache floodgates in my Cakephp app and now I want to close them... I've done pretty much everything I can: delete all files in the tmp folder (but not the folders), turned 'Cache.disable' on in the core.php file in my app, have tried clearing the cache from within some controllers with clearCache() and Cache::clear() (bu...

CakePHP - recursive on specific fields in model?

Hi, I'm pretty new to CakePHP but I think I'm starting to get the hang of it. I'm trying to pull related table information recursively, but I want to specify which related models to recurse on. Let me give you an example to demonstrate my goal: I have a model "Customer", which has info like Company name, website, etc. "Customer" hasM...

CakePHP - Order in $hasMany model being ignored

I have one model that has a $hasMany attribute. If I just have the following: var $hasMany = 'OtherModel' and in the class OtherModel extends AppModel I have the following: var $order = 'colour_id DESC'; The order is ignored, but if I have this in the first model: var $hasMany = array( 'OtherModel' => array( ...

CakePHP 1.3.0 RC4 Installation

I have been using 1.2.6 and downloaded 1.3 to try it out. I am using wampserver with Apache 2.2.11. I have mod rewrite enabled. When I bake a new application using the cake 1.3 console, after I verify that the webroot/index.php of the application CAKE_CORE_INCLUDE_PATH is set to the Cake1.3 Installation folder. The result is a page thats...

Speeding up CakePHP

I've been a keen fan and user of CakePHP for about 2.5 years now, but the main bugbear that most fellow developers level at the framework is that it's slow, and the dispatch cycle takes too long to make it a viable solution for production environments. I'm hoping that this question will inspire people to share their tips, tricks and hac...

CakePHP Permissions, works fine on local server, but fails after upload.

I created a website with CakePHP, set up all of the permissions so guests could view certain parts, and members only in certain areas, all with an administration panel. Whenever I test this on my local testing server, it works perfectly, if I login I can view the content, if I logout, I can't. However, when I upload exactly the same f...

why this sql not working?

I have a query public static function TestQuery( $start=0, $limit=0){ $sql = " SELECT count(*) AS total FROM db.table1 JOIN db.table2 ON table1.fieldID = {$fieldID} AND table2.assigned = 'N'"; $qry = new SQLQuery; $qry->query($sql); if($row = $qry->fetchRow()){ $total = intval($row->total); } ret...

cakephp: how to make NOW() work in search condition ?

I'm trying to get all records with date greater then now. I tried this but it doeasnt work: $all_dates = $this->TourDate->find('all', array('conditions' => array('TourDate.date >=' => 'NOW()'), 'order' => array('TourDate.date ASC'))); If I replace NOW() with the current date it works. Why's that? ...

CakePHP Form Helper Database Interaction

Currently I am developing a CakePHP that will list various businesses. In the database, there is a table for businesses that lists them like so: id | name | address | city | state | state_id | zip | url The state column are abbreviations of states (for listing purposes) CA, AK, FL, etc and the state_id matches up with the id...

Passing a URL as a URL parameter

I am implementing OpenId login in a CakePHP application. At a certain point, I need to redirect to another action, while preserving the information about the OpenId identity, which is itself a URL (with GET parameters), for instance https://www.google.com/accounts/o8/id?id=31g2iy321i3y1idh4&#51;q7tyYgdsjhd863Es How do I pass this d...

Cakephp, Route old google search results to new home page

Hi there, I have created a new website for a company and I would like all the previous search engine results to be redirected. Since there were quite a few pages and most of them where using an id I would like to use something generic instead of re-routing all the old pages. My first thought was to do that: Router::connect('/*', ...