开发者

Layout/Decoration framework for PHP?

A little of my background... 开发者_如何学CI'm fairly new to PHP as I primarily develop in Java. PHP interests me, thus I decided to spend my free time learning it by trying to make one of my relatively static websites more dynamic using PHP.

Right now, I'm have a problem in decorating all the web pages... not really a problem, but it bugs me. I know I can include the header and footer files in every page, but I'm wondering if PHP has some sort of web-based layout/decoration framework?

In Java, I use Sitemesh to decorate my web pages without the need for me to explicitly include the header/footer files. I'm hoping I can do the same in PHP too.

If you have abundance of experience developing web applications in PHP, can you please share some of your knowledge with me here? I'm interested to know the techniques you use to easily decorate your web pages and to change the page layout in the future.

I greatly appreciate your tips and ideas. Thanks much.


PHP doesn't neccessarily have a 'decor' framework, but more generally it has many MVC based frameworks for the language itself. Many of these include 'templating' elements that allow for such headers, footers, partial layout content, etc...

Some of these are

  • Codeigniter (My personal Choice)
  • Kohana
  • Zend
  • Symphony

Generally, people will recommend what they use, and most of the time you can't tell if they use it because they like it, or like it because they use it. I recommend consulting the specific frameworks documentation to get a feel for whether or not it fits your needs.

EDIT :

After a second read of your question, I also thought you might look into more simple CMS solutions. While you could accomplish what you want to do with any of these frameworks, it might be less work to use a CMS that uses a templating engine, if all you want to do is manage content and the way it looks. The frameworks listed above are a bit more adept and building web applications (for comparison, a CMS is a web application).

  • Wordpress
  • ExpressionEngine (By the makers of Codeigniter)
  • Drupal


I use a main template view for HTML pages. This includes the header and footer, but the middle has a <?php echo $primaryView; ?>.

I can change the $primaryView depending on what page needs to be shown.

The MVC pattern is very useful with web development.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜