Code

CakePHP Geshi helper

I have written a small Geshi helper for CakePHP, with Geshi you can display formatted code with colours. Just drop Geshi in your vendors directory and create a a helper to your taste.. personally I use a style helper which contains different methods to help format an article.

Now just create <pre class="php"> code goes here </pre> in your article and your done. Replace php with the language of your choice.

Read more...

CakePHP 1.2 Paginate associated model

Ok this took a while for me to figure out. But it is possible to override the default pagination function in CakePHP so you paginate a different model, i paginated all related articles on a tag with this example.

Read more...

ySlow make your pages fly

With ySlow it's easy to optimize your page, it will give you allot of tips to really make your pages fly. ySlow is an extension created by yahoo.

Here you can see my results. They are really impressive, the size of the page has gone from 580k to 253k on the first load. A cached page has even greater performance gains, from 45k to just 2.5k. Almost 20 times smaller. So here is how i did it.

Read more...

CakePHP Image helper

I wrote this image helper cause i needed it on my site, there was another one allready available on the bakery. However this did not meet my needs, this image helper has a resize for thumbnails, and a resize and crop which will cut off the top and bottm or left and right if it does fit the entered size. It also saves transparent png's which the other did not and caches the images.

Read more...