Welcome to MainelyDesign.com

Photos of Rockland, Maine. Summer 2009.

A blog mostly about web design

This is the personal blog of Kevin Wentworth.  Topics covered here are web programming, design and internet marketing.

Calling an Element from a Helper

Posted on 02/24/2012 at 02:07 pm | Viewed 548 times | 0 comments

This one caused me more than a little headache,  turned out it was easily solvable.

Forcing A Single Join in CakePHP Pagination

Posted on 10/14/2011 at 09:25 am | Viewed 1,736 times | 6 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 join code from a much more complex web app and pasted it into my new 'joins' conditions.  And then... I got SQL errors. 

Inserting NOW() into MySQL Using CakePHP

Posted on 08/11/2011 at 11:16 pm | Viewed 1,204 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:

Best PaginateCount for CakePHP - with Group By Support

Posted on 08/07/2011 at 05:03 pm | Viewed 1,643 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 quick look at my sql log tables (at the bottom of the page) and I saw that I had actually returned all the mysql records that were needed!  If only there was a way to use them...

CakePHP Error Messages Not Showing on Form

Posted on 04/03/2011 at 12:40 pm | Viewed 3,298 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 required fields were having the class .required added to them.  The only problem?  No error messages were being output to the form.  The form validation would fail, but the CakePHP error messages were not being shown.

Read More Posts.

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design