Most of the time, a web application will have some parts which are pretty constant no matter what you are viewing or editing. How to render these parts are not directly obvious since most of the CakePHP tutorials focus on developing the MVC parts of the application. After much code digging in some CakePHP applications, I've concluded that it is done using the renderElement function. You'll use it something like this in your app/views/layouts/default.ctp:
<?php $this->renderElement('mainmenu'); ?>
And then you'll have to create the file mainmenu .ctp in the app/views/elements directory. Piece of CakePHP eh.. ;)
This blog is about the PHP solutions I have to think of when I'm developing systems almost every single day...
Wednesday, January 30, 2008
Rendering page elements in CakePHP
Posted by
Abdullah Zainul Abidin
at
5:07 PM
0
comments
Tuesday, January 8, 2008
Some nice frameworks
I have been coding raw php for quite some time now (coming up to 3 years already) and I didn't find any need to look to other things which was available for free on the web like a proper framework or even a template engine. But now I've pretty much run out of gas started looking for thing which could my life as a php developer much easier.
The first thing I tried to look for a was better framework. Thanks to very excellent marketing done by the ruby on rails people, I found it's php counterpart, CakePHP. I have not made any production system with it yet, but from my limited amount of experimentation it is an excellent implementation of MVC concept in PHP. I like being able to sculpt the view for the application without worrying that I might break any part of the application. I like the pretty urls we can use to determine what we want to serve our clients. I like the active record concept where it will fetch even the data in other tables connected to the item. Very nice.
And one of my co-workers introduced me to his favorite framework, CodeIgniter. It has most of the things I like about CakePHP and on top of that it is quite raw as in you can even code directly just using some of its helpers rather than having to implement the whole framework. It is that easy to use. But then with parts and parcels like that it doesn't have the full active record concept of loading dynamically the data associated with the current data. But still it is an excellent framework.
Apart from frameworks, I was also looking into a template engine to ease my coding if I ever have to code raw. And I found smarty. It made me fall in love with the idea of using templates for my projects as it's clear and unobtrusive syntax won my heart. But alas, it is only a template engine. It doesn't pretty up your urls, doesn't handle your data for you and all other things. So I might use it one day, but most probably only for small projects which wouldn't require a full blown framework like CakePHP and CodeIgniter. Who knows...
Posted by
Abdullah Zainul Abidin
at
5:06 AM
0
comments
Labels: cakephp, code igniter, framework, smarty, template engine
Friday, January 4, 2008
Labels
- cakephp (27)
- HABTM (3)
- behavior (3)
- database (3)
- cache (2)
- component (2)
- query (2)
- Auth (1)
- acl (1)
- ajax (1)
- bake (1)
- bug (1)
- cakephp login (1)
- check boxes (1)
- code igniter (1)
- conditions (1)
- core (1)
- datepicker (1)
- find (1)
- framework (1)
- internationalization (1)
- joomla (1)
- link (1)
- model bindings (1)
- mysql function (1)
- php (1)
- recursive (1)
- redirects problem (1)
- resources (1)
- routing (1)
- shell (1)
- smarty (1)
- soft delete (1)
- template engine (1)
Blog Archive
-
▼
2008
(33)
-
►
February
(16)
- Finally got the behaviour working
- Warning!!! The error is cached
- CakePHP $html->link Variables
- What will you find?
- Fixup for the attach to anything plugin for cakeph...
- A soft delete behaviour
- Internationalization with CakePHP
- Output helper javascript into headers properly
- Ajax with Cakephp resources
- Login redirect causing problems
- Bindable behaviours
- HABTM Add & Delete Advanced Behaviour
- Using the Coolest DHTML/Javascript Calendar in Cak...
- Finally a working login in CakePHP
- Create a login in CakePHP
- Update on rendering element in CakePHP
-
►
February
(16)
