donderdag 13 december 2007

Programming Conventions

Hey,

Did you ever had a look at the CakePHP Conventions? I use CakePHP also to have the same directory structure in all of my projects, but it would be much more readable if you write your code using these conventions. What do you think about conventions like this? How do you bring structure to your projects?

Also, I'm looking for the best way to use Trac and Subversion in my projects. Does anyone have any tips? Is it possible to export a SVN repository to an FTP location?

dinsdag 11 december 2007

Build a photo gallery with CakePHP and Flickr

This is a nice howto from Jonathan Snook on building a photogallery with CakePHP and Flickr.

Within a few minutes and with a few lines of code and a few components he explains how you can do this, and even make use of a Lightbox to show the images. Have fun!

Use the Pages controller for static pages

You can use the pages controller for static pages like /pages/about or /pages/contact. This is a built-in controller which has some other possibilities, described at the Bakery.

maandag 10 december 2007

TagCloud Helper

I was just having a look at The Bakery and noticed an article from Suhail about a Tagcloud Helper. I looked for something like this in the past, and it might be handy in the future. Take a look: here.

New layout

Hey, I'm back with a new layout. I hope to write some posts soon, so keep watching this site. Also, I am looking for something combining twitter and this weblog. For example, when I write this, I want my twitter feed to be updated... guess I have to write something myself.

woensdag 14 november 2007

Soft delete records, some kind of trash...

Mariano Iglesias wrote an article on the Bakery about Soft deleting records in CakePHP.

donderdag 8 november 2007

CakePHP and MSSQL

It should be possible to have CakePHP directly talking to a Microsoft SQL server, but I don't know how and didn't try it. The advantage of talking directly to MSSQL is that you can use the standard Models.

Use Google Maps in CakePHP

I found an interesting article from Mahmoud Lababidi at the Bakery on integrating Google Maps in your CakePHP application.

maandag 29 oktober 2007

Use helpers in your application

It is advised to make use of helpers in your application. Your code becomes clean and more flexible because the helpers are short and clear, and they handle the paths to the file referenced. For example, to quickly show an image in your view, use:


< ?= $html->image('9.jpg') ?>

dinsdag 2 oktober 2007

findAllBy is cool!

Suppose you have a field name in your database called type. CakePHP will automagically add a new function called findAllByType. For example, you can try: findAllByType('customer'); to find all fields with type=customer.

From the CakePHP manual:




* findAllBy
* string $value

These magic functions can be used as a shortcut to search your tables for a row given a certain field, and a certain value. Just tack on the name of the field you wish to search, and CamelCase it. Examples (as used in a Controller) might be:
$this->Post->findByTitle('My First Blog Post');
$this->Author->findByLastName('Rogers');
$this->Property->findAllByState('AZ');
$this->Specimen->findAllByKingdom('Animalia');

The returned result is an array formatted just as would be from find() or findAll().

maandag 1 oktober 2007

Basic Task list with Ajax

Graham Bird has written a very nice tutorial on creating a Basic Task list with Ajax. Have a look at it here (http://grahambird.co.uk/cake/tutorials/ajax.php).

donderdag 27 september 2007

Make your code more readable

Of course, you write comments with your code... But, you can also make it more readable and logical by following the CakePHP coding standards:

debug(mixed $var, boolean $showHtml = false) can make your life easier.

Give convenience wrappers like e(), low(), up() and r() a try.