SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP 5 templating tutorials?

    Hi,
    I have just upgraded to PHP5 and I understand that many of the templating methods in PHP4 aren't compatible with php5 as many php4 class things don't work in PHP5. Are there any tutorials on how to write a PHP5 template engine from the ground up?

    Actually I just want to write a template engine in PHP5 to separate design from content. I really don't care if its OO or not.

  2. #2
    SitePoint Evangelist praetor's Avatar
    Join Date
    Aug 2005
    Posts
    479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't want to use php itself as a template engine, Smarty works very well. Yes, with php5.

  3. #3
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I want write my own template engine in php, I don't care if its OO or not.

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Code html4strict:
    <html>
        <head>
            <title><?php echo $mytitle; ?></title>
        </head>
        <body>
            <?php echo $mybody; ?>
        </body>
    </html>

    Simplistic but gives the idea of how a template can be made.

    http://allyourtech.com/content/artic...g_with_php.php
    http://www.google.com/search?q=php+templating
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  5. #5
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats I'll look at it. Logic_earth, I know how to do that. I was looking more how to do placeholder and have the HTML and PHP on different pages.

  7. #7
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you wish to completely separate HTML from PHP you may consider XTemplate.

    Until I used it as a template engine it turned to be quite good and very fast.

  8. #8
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't want to use anyone else's I just want to use my own.

  9. #9
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Archbob View Post
    I don't want to use anyone else's I just want to use my own.
    If you want to write your own, you are free to do it. Most of the people prefer to use already developed template engines, because they know they work fine, and do not want to spare their "precious" time.

  10. #10
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not writing a full engine, just something for this one script I'm going to write. I think I've got a hang on it.

  11. #11
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Archbob View Post
    I'm not writing a full engine, just something for this one script I'm going to write. I think I've got a hang on it.
    If I have got a hang on something (if not urgent) I just leave it, until someday I got inspiration to do it.

  12. #12
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by REMIYA View Post
    If I have got a hang on something (if not urgent) I just leave it, until someday I got inspiration to do it.

    There's a pretty good chance that'll happen actually as I'm busy with flash and world domination at the moment.

  13. #13
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Flash is not a bad idea. I have been looking at http://www.openlaszlo.org recently

  14. #14
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm interested in flash games at the moment. I own flashninjaclan.com . So I'm working on creating content. But I'll come back to PHP soon enough.

  15. #15
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Archbob View Post
    I'm interested in flash games at the moment. I own flashninjaclan.com . So I'm working on creating content. But I'll come back to PHP soon enough.
    I was kind of thinking on implementing Flash in PHP.


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
  •