Recent Posts
- (10/14) Forcing A Single Join in CakePHP PaginationTAGS:CakephpCakephp 13DatabaseErrorsHabtmMysqlMssqlWeb ProgrammingUsage
- (08/11) Inserting NOW() into MySQL Using CakePHPTAGS:CakephpDatabaseMysqlMssqlWeb ProgrammingUsage
- (08/07) Best PaginateCount for CakePHP - with Group By SupportTAGS:CakephpBehaviorsWeb ProgrammingUsageDatabaseExampleMysqlHabtmHack
- (04/03) CakePHP Error Messages Not Showing on FormTAGS:CakephpCakephp 13Web ProgrammingErrorsUsage
- (02/06) Sorting Paginated Results Using a Related Model Field in CakePHPTAGS:CakephpWeb ProgrammingUsageExample
- (11/02) Changing CakePHP's Model useTable on the FlyTAGS:CakephpWeb ProgrammingMysqlDatabaseExampleTutorial
- (10/18) The Funniest Error Message Ever - Thank You EclipseTAGS:EclipseWeb ProgrammingErrorsHumorWindowsUsageSoftwarePhpCakephp
- (09/27) Upgrading CakePHP Application to 1.3 (from 1.2)TAGS:CakephpUpgrade
Subscribe to my feed
MainelyDesign.com Blog
Tutorial Tagged Blog Posts
Changing CakePHP's Model useTable on the Fly
Posted on 11/02/2010 at 05:12 pm | Viewed 2,703 times | 1 comment
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
Read: Changing CakePHP's Model useTable on the Fly | View: Comments
Using KDiff3 as Git GUI Merge Tool on Windows XP and Windows 7
Posted on 09/23/2010 at 01:39 pm | Viewed 8,218 times | 0 comments
I've been looking for the silver bullet solution to using KDiff3 as my git mergetool on Windows (using Git GUI). I've finally got a solution that works in every Windows environment I've tried:
- Add the KDiff3 directory to your Windows System Path (e.g. C:\Program Files\KDiff3\)
- Add kdiff3 as your Git mergetool (From Git Bash, run git config --global merge.tool kdiff3)
- Add kdiff3 complete path to Git Config (From Git Bash, run git config --global meregtool.kdiff3.path "C:/Program Files/KDiff3/kdiff3.exe")
- Go into Git GUI settings and set the mergetool to kdiff3 (if Git GUI doesn't pick up this setting from git config, which it should)
Read: Using KDiff3 as Git GUI Merge Tool on Windows XP and Windows 7 | View: Comments
Getting All ACL Permissions in One Lookup (CakePHP 1.3)
Posted on 09/19/2010 at 11:36 am | Viewed 4,647 times | 1 comment
The biggest hurdle I've had to overcome migrating my CakePHP application from 1.2 to the much improved 1.3 branch involves Plugins and the ACL component. A while back I noticed that my backend was kind of sluggish due to all of the ACL lookups (that happen with each request) so I optimized my ACL database tables. At that same time, I also discovered an incredible mysql query that would lookup all of the ACL permissions for a particular ARO. This setup worked great... until I started upgrading to CakePHP 1.3.
Read: Getting All ACL Permissions in One Lookup (CakePHP 1.3) | View: Comments
Global Mysql Find and Replace with CakePHP
Posted on 08/31/2010 at 09:03 am | Viewed 1,732 times | 0 comments
I'm moving my Content Management System over to CakePHP 1.3. I'll post an article about my experiences later. Today I will focus on one and only one issue with the migration from Cake 1.2 to 1.3: the change of webroot/theme/ to webroot/theme/ to serve static content. At first I was a little disapointed/scared at the prospects of making this change, but have since come to see the absolute brilliance in this approach.
Read: Global Mysql Find and Replace with CakePHP | View: Comments
Controlling CakePHP Error Handling When Debug = 0
Posted on 04/19/2010 at 04:27 pm | Viewed 8,525 times | 3 comments
I finally had a client request a piece of functionality that required me to program CakePHP so I could better control the default error handling when the site is in production mode (i.e. debug is set to 0). By default, CakePHP will throw a 404 page not found header whenever ANY errors occur on a production site with debug equal to zero. This works great, most of the time. But what about when you are having database connectivity issues? Say when there are too many mysql connections to that overloaded shared hosting box? Modifed CakePHP error handling to the rescue.
Read: Controlling CakePHP Error Handling When Debug = 0 | View: Comments
Setting Envelope-From in CakePHP's Email Component
Posted on 03/22/2010 at 05:56 pm | Viewed 2,874 times | 1 comment
I've setup a form that allows customers to sign up for an email newsletter and receive a coupon. I wanted to be able to track the bounced messages in case a legitimate customer's coupon was bounced for whatever reason. As I've learned, setting up the "return-path" for an email message isn't as simple as setting $this->Email->return = 'email@domain.com'; You have to use an as yet undocumented feature... $this->Email->additionalParams;
Read: Setting Envelope-From in CakePHP's Email Component | View: Comments
2 Neat Little PHP Tricks
Posted on 03/16/2010 at 04:15 pm | Viewed 1,993 times | 0 comments
In writing a function to validate bank routing numbers, I came across two simple techniques, that I know I will need to use again:
PHP Trick 1: Remove All Characters Except Numbers from a String
A simple little regex does the trick:
$routingNumber = preg_replace('[\D]', '', $routingNumber);
Create a Checklist Group or Related Checkboxes in CakePHP
Posted on 03/05/2010 at 12:38 pm | Viewed 5,265 times | 1 comment
This is an interesting one. I needed to create a group of checkboxes. In my mind, it's just like a radio button group, except with checkboxes. The only difference should be that with radio buttons you can only select one, while with a checkbox group you should be able to select as many as you want. To achieve a checklist group in CakePHP is a little convoluted.
Read: Create a Checklist Group or Related Checkboxes in CakePHP | View: Comments
Export to PDF from Microsoft Publisher
Posted on 03/05/2010 at 10:54 am | Viewed 1,374 times | 0 comments
I have a client that sends me newsletters in Microsoft Publisher format. I wanted to output the newsletter as a PDF, but wanted to keep the text for SEO and so users can copy and paste the text if needed. Microsoft Publisher doesn't have an export to PDF function, so usually I would just do a File > Print and select Adobe PDF as the printer. However, this would just be an "image" of the document, not the actual document with selectable text. This is how you can get a PDF with rendered text out of Microsoft Publisher...
Read: Export to PDF from Microsoft Publisher | View: Comments
Which Submit Button was Clicked in CakePHP? Use Name.
Posted on 03/04/2010 at 12:01 pm | Viewed 5,304 times | 2 comments
If you want to have multiple submit buttons that make a form do different things there's a simple way to do this. The name of the submit button that was clicked by the user will be sent (via POST) with all the other POSTed data. This is very handy if you want to have a cancel button and continue button. In CakePHP the name of the button won't be in $this->data, but it's easy enough to get...
Read: Which Submit Button was Clicked in CakePHP? Use Name. | View: Comments
PHP Break Out of All Foreach or While Loops
Posted on 02/25/2010 at 02:44 pm | Viewed 3,272 times | 0 comments
Let's have some fun with PHP's break command... I didn't think it was possible. I just learned (I've been programming PHP for like 7 years) that you can instruct break how many levels of nesting to break out of! I'm not surprised that break in PHP allows you to specify the number of loops (or switch statements) to break out of, but I am surprised it took me this long to use it!
Read: PHP Break Out of All Foreach or While Loops | View: Comments
Changing the Order Sequence of CakePHP Behaviors
Posted on 02/25/2010 at 07:20 am | Viewed 1,731 times | 2 comments
For reasons too long to explain in this post, I have two behaviors that are run on the same pieces of data (a translate behavior and a settings import/export behavior). One behavior is attached to the model using var $actsAs, while the other behavior is attached dynamically, during runtime using $this->attachBehavior();. I needed the "hardcoded" behavior to run after the dynamically attached behavior. Here's what I did:
Read: Changing the Order Sequence of CakePHP Behaviors | View: Comments
Getting a List of Database Tables in CakePHP
Posted on 02/23/2010 at 12:22 pm | Viewed 2,440 times | 1 comment
I ran into an interesting problem today. What I wanted to do was know if a table didn't exist in my CakePHP application. What happens- a cakeError is thrown everytime a database table doesn't exist. This is really annoying...I think it would be beneficial to be able to tell Controller::loadModel() to return false instead of an error message. That's not the case. Here's how I got around it (with thanks to Miles Johnson):
Read: Getting a List of Database Tables in CakePHP | View: Comments
Best CSS Method for Using Image as Submit Button
Posted on 02/03/2010 at 12:17 pm | Viewed 3,185 times | 2 comments
I came across an interesting issue with web forms and CSS. Surprisingly, the end result is much better than I expected. I knew that using an image instead of a traditional form submit button (<input type="submit">; instead of <input type="image"> or <input type="button">) would be a little challenging. I like a challenge, plus I wanted to use the submit button because it's the standard approach to forms and I remember reading somewhere that input's of type image or button do not submit when you press enter...a usability faux paus in my opionion.
Read: Best CSS Method for Using Image as Submit Button | View: Comments
Using Git and Plink for SSH on Windows
Posted on 01/25/2010 at 11:11 am | Viewed 5,323 times | 0 comments
Well, I finally had an opportunity to install Git on Windows yet again. It had been quite a while since my last time installing Git on Windows, so I was a little rusty and couldn't figure out how to get Git to use Plink for SSH. It's actually quite simple and dependent on a Windows system variable.
Getting Git to use Plink for SSH on Windows
Read: Using Git and Plink for SSH on Windows | View: Comments
Using Jquery for target="_blank" and strict xHTML
Posted on 12/28/2009 at 03:27 pm | Viewed 2,775 times | 0 comments
If you like to see the little green check mark that HTML Validator shows when your HTML is 100% valid, you'll love this little trick. Thanks to badlydrawntoy.com.
Read: Using Jquery for target="_blank" and strict xHTML | View: Comments
12 Essential Photoshop Keyboard Shortcuts
Posted on 12/21/2009 at 05:05 pm | Viewed 2,062 times | 0 comments
I remember about 7 years ago watching my friend use Adobe Illustrator. He was a communications design major and used his keyboard more than his mouse. I was blown away when I realized how much time you could save by learning keyboard shortcuts for Adobe's products. This is my list of the best Adobe Photoshop keyboard shortcuts for web designers.
Read: 12 Essential Photoshop Keyboard Shortcuts | View: Comments
Full Tag List
- Cakephp
- Web Programming
- Site Avenger
- Excel
- Csv
- Database
- Saveall
- Vendors
- Import
- Truncate
- Empty Table
- Forms
- Habtm
- Usage
- Tinymce
- Geshi
- Usability
- Upgrade
- Graphic Design
- Internet Marketing
- Software
- From The Hip
- Midcoast Magnet
- User Group
- Component
- Mssql
- Git
- Apache
- Seo
- Htaccess
- Mysql
- Eclipse
- Gear
- Photoshop
- Php
- Css
- Iis
- Web Server Admin
- 404 Errors
- Iisreset
- Web Design
- Hack
- Internet Explorer
- Ie
- Firefox
- Forum Answers
- Jquery
- Swfupload
- Windows
- Example
- Links
- Tutorial
- Errors
- Behaviors
- Cakephp 13
- Humor
