Rick Hurst Web Developer in Bristol, UK

Menu

Month: January 2009

Adventures in cakephp

I’m part way to achieving one of my 2009 goals – i’ve got a commercial project live using cake php 1.2. The site is Kudos Business technologies – a company who specialising in LED lighting and other technologies aimed at lowering environmental impact and saving money.

kudos business technoliogies - led lighting and other low impact technologies

The site has actually been refactored from a static HTML site, most of the pages are still static, but make use cake’s routing, page templates, layouts and elements. The news section is dynamic, and was very simple to put together, but i’m only half way there – currently I haven’t got any proper admin forms – that will have to be phase two! The learning curve so far has been very small – i’m looking forward to taking it a bit further.

archived comments

Hey,

I’ve been using Cake for a while so if you need help with anything feel free to give me a shout. Also check out Symfony. It’s like cake, but without the limitations of supporting php4.

Dan W 2009-01-28 22:17:32

Good work Rick – might want to remove the default cake favicon though

Andy Gale 2009-01-29 09:50:17

Hi Rick,

Great work on completing your first commercial site in CakePHP.

You mention you use mostly static page content and that the news section is dynamic… I assume your new page has a controller all of its own right now? And that the static pages are stored in the views/pages directory? If so then your routing is nicely done, usually I would expect to see the /pages in the url – the fact that you have managed to mix the pages and the controllers in your routing is great and something I have never considered doing.

Take a look at a commerical site we had a requirement to create … http://www.cheaperagain.co.uk/quote – you will notice that the URL has /quote in – quote is the name of a model/controller… and most pages on the website fall under 2 models, the quote model and the provider model. There are 3 pages that are under the prebuilt /pages directory… terms and conditions and help etc – if you click those you will see they pull up the pages/whatever in the URL.

I’m going to have to bare your post in mind for the next cakephp project we start on, and make sure I tidy the routing up fully.

Cheers,

James Mikkelson 2009-02-21 10:04:24

Viewlets related Plone 3 theming article and discussion

There’s an interesting Plone 3 skinning article over here, which describes how to use viewlets. More interesting to me is the discussion at the end. The general points made here are:-

  • Viewlets are complex and can be a barrier to non-programmers, but are probably being used for the wrong things
  • Plone 4 will have some radical changes to make stuff like this easier (but learn Plone 3 in the meantime)
  • Deliverance is an alternative for skinning, may ship with Plone 4
  • Rolling your own public facing skin that ignores viewlets altogether is another alternative

Setting up a plone 3 dev environment on osx leopard

Firstly, to echo something mentioned in one of the articles referenced below – if you just want to install and try out plone on osx leopard – use the installer provided on plone.org. If you want a little more control, or want to get a better understanding of how things work, below describes the steps used to get the development environment I have just set up. I usually get these things wrong when I venture out of the realms of point and click installers, but this was fairly painless. The main purpose for this post is to self-document the process for next time, but hopefully other will find it useful.

1. Install PIL using macports

after installing macports (GUI installer), run this in a terminal :-

$ sudo port install jpeg

This ensures that PIL (Python Imaging Library) is compiled with jpeg support. Thanks to Tom Lazar for the tip

2.check out (from svn) and run this excellent buildout by Florian

(in your home dir – you’ll need svn installed)

$ cd
$ svn co http://svn.plone.org/svn/collective/buildout/python-macosx/
$ cd python-macosx
$ python bootstrap.py
$ sudo bin/buildout

This builds several different versions of python, and creates a virtualenv for the 2.x versions. I tried doing the last step without sudoing, but it wouldn’t have it. As a result, you’ll need an additional step to change the ownership of some of the files/ folders created by the buildout:-

$ cd ../
$ sudo chown -R yourusername python-macosx

3. Activate your python 2.4 virtualenv:-

$ cd python-macosx/python-2.4
$ source bin/activate

Your command prompt should now have (python-2.4) instead of a $. For information on what a virtualenv is and why to use them, see Dan’s article linked below.

4. Follow the instructions for installing ZopeSkel and Plone in Dan Fairs’ article

(^^ scroll down and start at the heading ZopeSkel)

(python-2.4) easy_install ZopeSkel
(python-2.4) paster create -t plone3_buildout p3
(python-2.4) cd p3
(python-2.4) python bootstrap.py
(python-2.4) bin/buildout

5. start zope in foreground mode:-

(python-2.4) bin/instance fg

I think that’s it. One thing to note is that both the python-macosx and plone 3 buildouts died on me at one point (stalled with no errors – wasn’t sure if it was going to come back to life at a later date, so killed the process after about ten minutes of nothingness). In both cases I just tried the buildout again and it worked second time around. Hopefully I haven’t missed anything – please do comment if you think I have, or if you followed the above step by step and had no problems/ problems. At time of writing i’ve only tried creating a default plone site and uploading an image to test the PIL support.

Graham Higgins for the heads-up!