30 Nov 2010

Coldfusion

It's been a while since I wrote anything, but that doesn't mean I haven't done anything. I've been head down wrapping up a CakePHP CMS before I changed jobs. Now I'm a Coldfusion developer. WTF? I've never used it but working through the tutorials it seems really straightforward. I guess the hard part will be letting go of MVC. Of course, someone has cooked up an MVC framework for CF, but there's too much legacy in my new job to even think about it.

I'll still be doing the CakePHP stuff as well as I have one or two personal projects and, for a smalltimer, hosting Coldfusion is just too expensive.

30 Jul 2010

Basic .htaccess Modifications

This is a useful .htaccess for a basic CakePhp website. It enables
compression, normalises URLs by removing 'www' and then moves on to the
standard CakePhp redirection:
# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 
text/javascript
<IfModule mod_rewrite.c>
RewriteEngine on
# Convert all http://www.example.com style URLs to http://example.com
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>
In certain situations - in this case our CMS - this substitution might 
be useful:
#RewriteRule    ^$ app/webroot/    [L]
RewriteRule    ^$ my-anchor-page    [L]

29 Jul 2010

INSERT rows with SELECT & mixed data

To extract values from one table, to update another where you also need
to supplement the data - in this case
(`module_type_id`,`module_id`,`zone_id`,`position`) are static
(12,42,12,1) - include the supplementary values in the SELECT statement:

INSERT page_items 
(`node_descriptor_id`,`module_type_id`,`module_id`,`zone_id`,`position`)
SELECT id ,12,42,12,1 FROM node_descriptors

20 Jul 2010

CakePHP offline manual

There used to be an offline manual - I don't remember whether it was official -  but there no longer seem to be any direct links. A little digging around revealed some answers which I thought it would be useful to share.

These are links to the manual in one page - useful for creating a PDF using Dardo Sordi Bogado's build script: http://rapidshare.com/files/218826372/manual-builder.zip. It is also very useful for searching quickly using ctrl-f in your browser.

Also see this thread: http://groups.google.com/group/cake-php/browse_thread/thread/5f45c1d0

17 Jun 2010

template woes

Yeah, okay, the template is a bit raw, but not as bad as the old one. When I get some time I'll neaten things up a bit.