user393964
user393964

Reputation:

template system for the zend-framework

I'm not sure how to go about this in ZF. I searched on google and SO but didn't find anything useful. (And I don't wat to use something like smarty)

What I want is a template system similar to wordpress. And have it split up in certain files, for example header.phtml, body.phtml, sidebar.phtml and footer.phtml

How do I call these all together? One problem is that each one of these 'views' could have it's own functions to run (header needs to retrieve the navigation from the DB, body needs all the articles from the DB, sidebar might need the categories from the DB)

Some methods could even be in different controllers, for example, if I could have a separate login form, but what if I want to show the login form on the side bar as well? My login method is located in my User controller!

How do I reach all these methods/actions and place them in one website?!

Any suggestions/article links how to go about this? I'd like my template system to be easy to edit in case I'd want to change the look of the website.

Upvotes: 0

Views: 1565

Answers (3)

ben
ben

Reputation: 11

wordpress is a kind of CMS ( content management system), not a templating system. It sounds like you wanna learn how to use Zend Framework, am I right? If it does, you need to learn MVC design pattern, all of the frameworks is a kind of MVC design pattern.( Model - View - Controller), for example, action means its role is a kind of controller in MVC.

To put it simply, maybe you needs to understand how to use ZendFramework View script, hope the following help. http://framework.zend.com/manual/en/zend.view.scripts.html

Upvotes: 1

Fred
Fred

Reputation: 1627

Your solution is not a templating system. IMHO you don't need one. Just do some tutorials with ZF, learn about Zend_Layout, Zend_View and MVC. You will find solutions that suits your need.

Upvotes: 2

Nathan
Nathan

Reputation: 3920

The frameworks all try to answer this question well. See Symfony, Zend Framework, Cake, CodeIgniter, etc.

If you're just starting out with PHP and want it simple, use include_once() like we did in the old days, when we coded up hill both ways.

Upvotes: 0

Related Questions