Creating a Bake template for Dummies

So I finally started working on CakePHP…and it wasn’t easy at the start. I am writing this blog because there might be others who would face the same issues. Having gone through cake for 2 days, I feel that it is one of the awesomest thing ever. The best part that I like is the Cake Console. I haven’t used most of it, but from my point of view(the beginner‘s point of view!!), it is very helpful once you start figuring it out.

So first after understanding the basic structure and all, I knew that I could make(bake) a CRUD using the cake console. The command for it is pretty simple.

bin/cake bake all tablename

Now villages is my table name and all. But it used the default template and I did not like it. So I went through the offical documentation and did what was written here:
http://book.cakephp.org/3.0/en/bake/development.html#creating-a-bake-theme

This was done in order to change the layout template of my web app. But, being at level 1, my common sense is not as mature as others when it comes to cake.
So after a bit of researching, I did this, since the procedure was above was not helping me much or I was going wrong.

I ran this code to create a plugin

bin/cake bake plugin athena

This line creates a plugin named “Athena” in my plugins folder and other stuff inside it.

And then I decided to create the template inside it. I copied the folder Bake from vendor/cakephp/bake/src/Template into plugins/Athena/src/Template

Once this was done, I modified the index.ctp, edit.ctp, etc from Template and I was done. The next thing to do was to bake the cake with the following command.

bin/cake bake template --theme="Athena" villages

Hope this is helpful for others like me who are at level 1 in the baking game!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s