SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Building a Template Parser Class with PHP

    Building a Template Parser Class with PHP

    It is easy to create a templating system in PHP; in fact, there are a number of templating system packages. But what if you're putting together a relatively small website, and don't really need one of those full-fledged systems? In this first part of a two-part article, you will learn how to create a simple but extensible PHP class for parsing templates.

    Introduction

    Without a doubt, PHP is one of the most popular languages currently available for fast Web development. Its extreme ease and flexibility has made it a great source for creating a wide gamut of applications, well suited for satisfying the needs of different projects. Certainly, one of the most common applications that have grown noticeably in popularity is what is widely know as a templating system.


    http://www.php-dream.com/php-code/31...hp-part-i.html

  2. #2
    SitePoint Wizard PHPycho's Avatar
    Join Date
    Dec 2005
    Posts
    1,201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why to use templating engine in PHP though php itself a templating engine.
    I just hate the way {} works in smarty, that's totally a burden/overhead to the parser.
    Rather stick with MVC approach where V is like:
    PHP Code:
    <?php foreach($articles as $article): ?>
    <tr><td>.....</td></tr>
    <?php endforeach; ?>
    So easy to use, no need to learn extra things for using. If PHP is known that's more than sufficient.

  3. #3
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey commm, there are no example for such an often case as iteration.

    you've ended up with some ridiculous implementation of php's include.
    but real template needs weren't even touched.
    there must be blocks support for that way of templates


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •