Question

Was wondering if it's possible in CakePHP to do templating for my views like you can in Pylons/Pyramid with mako templating by defining an element e.g. comment_util and put a bunch of different elements within that?

Essentially you'd have one parent element, and within it, a bunch of child elements and then inherit that namespace and pass whatever you want when you call it throughout your views (as needed).

Was it helpful?

Solution

I haven't used Pylons/Pyramid Mako, but im going to respond to what you explain :)

you may call all the elements you want, but you are advice to use content for layout in your layout for the dynamic content (the views), though you may use elements with dynamic contents. I have in a page a logo element that shows dinamicly the company logos the page represents. Since it was in all pages i put the $this->set inside the appController.

You should be able to call elements within elements since what cake does is a render of the element, i haven't test it though. So theorically is possible what you want to do. Just Make sure to always set the variables you are using inside.

What you set with $this->set should be available in your elements as well, at least that is what i have experience in 1.3

Hope this helps you :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top