Showing posts with label CakePHP. Show all posts
Showing posts with label CakePHP. Show all posts

1 Dec 2010

The Coldfusion Blog Tutorial

There may well be one out there, but I didn't look too hard.

Today, snowbound at home, I am adapting the CakePHP blog tutorial to Coldfusion. The only difficulties will be that cakePHP & MVC makes a lot of things very easy, but doing it in CF is going to be very 'hands on'. At least I'll get a lot of low-down experience with CF.

If it proves to be interesting or useful and if I have the time or the inclination, I may well publish it for the benefit of other CF newcomers.

20 Apr 2010

ACL at page level

I've been messing around with CakePHP's built in ACL functionality. I tried it a while back (2007), but just couldn't make sense of it. Now, following Mark Story's tutorial in the Cake Book (and also his blog: http://mark-story.com/posts/view/auth-and-acl-an-end-to-end-tutorial-pt-1 ) , I have it working. He makes it very easy.

Now I'm tinkering with it to make it work on a page level. Success at this will mean I can use the CMS to create admin pages as well as public pages. When I've sussed it, I'll publish.

13 Apr 2010

CakePHP, .htaccess and clean homepage urls

Sometimes we need a clean url for the homepage to appear in the browser address bar, e.g. www.example.com

This problem came up with the CMS system I have built as all the pages have a url/name. For example, the default homepage would show as www.example.com/homepage.


Typing www.example.com would redirect to this and change the displayed url. The desired behaviour is to redirect
www.example.com -> www.example.com/homepage but only display www.example.com.

On the other hand, if you were to type www.example.com/homepage the display should stay as www.example.com/homepage .

The answer means a slight change to the default CakePHP .htaccess file

RewriteRule ^$ app/webroot/ [L]

becomes
RewriteRule ^$ homepage [L]

Of course, homepage could be any page name that you want to be the anchor page.

19 Mar 2010

Yeah, yeah...

...why didn't I build my own blog? After all, CakePHP even comes with a build-a-blog-tutorial. I just don't seem to be able to find the time.

I've just spent the last few months building a Joomla-killer of a CMS. Okay, it's tailor made for our company, but it's very open and flexible. Modules are easy to code and incorporate, page building and navigation is drag and drop and the whole thing hangs together with a modified preorder tree traversal algorithm (MPTT) - Google it. Best of all, it's built with CakePHP. It's easy for designers to learn and easy for programmers to code. Hopefully we'll open source it when we can think of a name for it. That way, more modules will be written and shared. Life needn't be so drupal.

Anyway, back to the yeah yeah, I will, one day, build my own blog. Just not yet.

23 Feb 2010

Making CakePHP websites load quicker

All frameworks are guilty of slowing things down owing to the code overheads and additional processing required to perform even simple tasks. Unfortunately, CakePHP seems to attract more criticism than others in this respect. We're talking milliseconds per page, but it all adds up.

Once a CakePHP website is deployed, there are a number of very basic things to do that should cut that time by more than half. Maybe with extra tweaking, you can get that time down even more.

Anyway, let's start with the key things.

Turn off debugging. Easily overlooked, but in my experience when you disable it, you'll have made the biggest improvement - time now about 50% of original load time.

Add gzip compression to .htaccess:
# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml


For CakePHP's ./.htaccess (the one at the very root) this will look like:
# compress all text, html, css and javascript:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css

RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

this should be good for another 20% - time now about 30% of original load time.