When I start with CakePHP at the beginning I created my views, controllers and models manually. It was a lot of work to do the initial process especially when I still learned the Framework. Then I found /I cannot remember where, probably in another blog/, bake.php script in the {cakeproject}/cake/scripts/ directory which simplified very much the initial process.
So far I am working for the Italian market and I don’t have any particular knowledge in Italian. The communication between me and my colleagues is in English,but the final product should be in Italian, so the Translation is really necessary.
With bake.php the initialization was very easy, but the Translation and some additional requirements which we had, missing in the script and caused more work than help. When I start with bake.php script I wanted to make these changes in th beggining but to do that I had to touch in file with 2000 lines of code with long string variables which hold the templates. It was pain to understand the logic. That’s why I prefered to generate all files and then to go through them and to make necessary changes.
Few months back CakePHP release 1.2beta of the Framework and the bake.php script evolve in cake.php placed in {cakeproject}/cake/console directory. The bake section was fully templatized and now everything which you need to touch is outside in template files placed under {cakeproject}/cake/console/libs/templates/views directory. There are home.ctp, form.ctp, index.ctp and view.ctp which could be modified before the initial build of all views. You have to touch them very carefully, but once you make the changes the script will use these files and will save a lot of work and believe me – that’s really help!
http://cakebaker.42dh.com/2007/06/11/baking-views/ goes into a little more detail about creating your own bake templates.
A better place to put them is
/app/vendors/shells/templates/views
because they wont be overwritten if you upgrade the cake install.
Hope this helps.
@Richard,
You are completelly right. I also didnt like the possibility to “touch” anything in the cake folder.
The place, where the app templates should be is quite strange, but anyway, better there than in cake.
Thanks for the info!
Wow! Exactly what I was looking for… This is going to save me a lot of time because I want to use bake heavily in my application so I didn’t want to change every view to match my CSS stylesheet… Thanks!
This is really an effective time saving process..
good idea indeed…
This seems to be an interesting idea for saving time as well as to speed up process. Nice hub.