MainelyDesign.com Blog

Showing articles 51 - 60 (142 total)

Calling an Element from a Helper

Posted on 02/24/2012 at 02:07 pm | Viewed 8,653 times | 0 comments

This one caused me more than a little headache,  turned out it was easily solvable. renderElement() can be used in a helper function. The following example worked nicely for me. In this case I am calling and element "order_form.ctp"   $theView = ClassRegistry::getObject('view'); echo $this->output($theView->renderElement('order_form'));...

Forcing A Single Join in CakePHP Pagination

Posted on 10/14/2011 at 09:25 am | Viewed 16,573 times | 0 comments

The devil's in the details... I was trying to make a really simple, dreadfully easy, database join in my CakePHP web application.  I've forced joins in Cake before, using the 'joins' key in the options array for find calls and paginate calls with no issue.  It was late and for the first time I only wanted to use a single join.  I copied the...

Inserting NOW() into MySQL Using CakePHP

Posted on 08/11/2011 at 11:16 pm | Viewed 10,317 times | 0 comments

Great find.  If you want to insert NOW() into your query using CakePHP's save() or saveAll() functions, you can use the following expression: $this->data['Model']['custom_date_field'] = DboSource::expression('NOW()'); Not sure how it works on MSSQL, but I will be testing that soon. Cheers, -Kevin Wentworth

Best PaginateCount for CakePHP - with Group By Support

Posted on 08/07/2011 at 05:03 pm | Viewed 14,229 times | 0 comments

I'm been muddling my way through pagination with multiple joins, and complex filtering.  I finally got it all working (more on that later, maybe....) when I noticed that I couldn't paginate my results.  Everything was working fine until I added a "group" parameter to the find call.  Instead of getting the right count, I got a count of 1!  A...

CakePHP Error Messages Not Showing on Form

Posted on 04/03/2011 at 12:40 pm | Viewed 15,230 times | 2 comments

I ran into an issue today that I've run into before, except I couldn't remember what I did to fix it (hence this article).  I was using CakePHP validation rules to validate a user account details.  The CakePHP validation was properly failing (the form data wasn't being saved) and I could tell the validate array was set correctly because the...

Sorting Paginated Results Using a Related Model Field in CakePHP

Posted on 02/06/2011 at 10:12 pm | Viewed 14,214 times | 0 comments

Time crunch, so this will be quick.  I didn't want to go hunting for how to sort paginated results in CakePHP using a related model field again.  I actually found my answer on Stack Overflow.  The original poster had it right, so I'm not sure if it was a CakePHP bug or what (I don't have an account or I would correct it... it's on the list of...

Changing CakePHP's Model useTable on the Fly

Posted on 11/02/2010 at 05:12 pm | Viewed 13,259 times | 0 comments

I finally found an answer to/solution to something I've never been able to get around in CakePHP before: dynamically changing/setting the useTable value in a model.  You can't just say $this->CakePHPModel->useTable = 'cakephp_table_name';  Instead you have to use the following function: Setting CakePHP Model useTable Dynamically...

The Funniest Error Message Ever - Thank You Eclipse

Posted on 10/18/2010 at 06:34 pm | Viewed 10,575 times | 0 comments

In a depature from my [normally] on-topic (i.e. dry) posts I had to post this error message up here. It made me laugh! I was working on the fattest CakePHP controller known to man (over 4,000 lines, I know... not skinny) when Eclipse ran into issues.  Eclipse gave a very descriptive error message, stating that it couldn't, well see for...

Upgrading CakePHP Application to 1.3 (from 1.2)

Posted on 09/27/2010 at 09:33 pm | Viewed 10,621 times | 2 comments

I've been waiting to publish a completed article until after I was done with my upgrade to CakePHP 1.3.  Well, it's taking a while.  I'm not blaming the CakePHP upgrade from 1.2 to 1.3 for taking so long.  I'm actually doing several large-scale changes to my code base, my server and my repository structure.  Until that time, I'm going to...

Common SSH Commands (An Idiot's Guide)

Posted on 09/25/2010 at 09:25 am | Viewed 9,488 times | 2 comments

Well, I never thought I would be saying this, but I'm starting to love using SSH to manage certain elements of my server.  Now that I'm using ssh bash to make some updates to my server, I find myself constantly hunting for the simple commands.  I'm going to put all the commands I need below, because I'm the idiot and it's my guide. Changing...

    2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10   

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design