Underwater with CakePHP 1.0

Well it didn’t take long for me to get thoroughly confused with CakePHP and a totally new way of structuring things. In the past I’d always create a directory called ‘templates’ where I’d include template files and a separate directory called ‘includes’ where I would include the php code that would query the database and organize the data to be viewed in a template.

I’m trying to figure out how this translates to CakePHP right now. This is going to be a very fluid post because I’m hoping that by writing about the issues that confuse me I will be able to eventually stumble upon the solutions. I feel a lot like I did when I was first learning alpha channels in Photoshop (before PS had layers). I remember the moment I ‘got it’ and it totally opened up Photoshop for me. Now I’m going to headbut CakePHP until I get the same end result.

Elements! So by placing chunks of my code into CakePHP’s Elements I can efficiently get access to and reuse that code. So for instance I have place my mast into an element, my footer into an element, and my primary navigation into an element. Elements can be cached in CakePHP 1.2 so not only do I get the benefit of reusable blocks of code, but I also gain the efficiency of having these blocks automatically cached on the users browser.


About this entry