SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Whats in a Template?

    Hi all,
    I was wondering if anyone knows of a good tutorial or some good code on making a database driven template engine.

    ANY help would be greatly appreciated, I will continue scouring on google, but if someone knows a good tutorial that doesnt use phplib or fast template then I am all ears
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  2. #2
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found a content management system that uses a crude template engine, but I am trying to understand how this is working...

    mArticle


    Any type of help about making this template engine work would be grateful as it does use eval() and im not too familiar with this command myself.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  3. #3
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check it out on PHP.net: eval()

    The short of it is that eval() accepts, as an argument, some PHP code, which it processes. This allows people to process templates and such, replace all their variables with actual values, etc, and then assign all the resulting data to another variable, if they want.

    I use my own method, but it's primitive as far as DB-driven templates go. It works well for me, though I would recommend setting your sights higher, in an attempt to duplicate something like mArticle's, or vBulletin's.

  4. #4
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, I basically copied mArticles code and beefed it up with better caching options, etc.

    now it works like a charm
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, I dunno if it's kosher to copy Mike's code...you might want to ask him...he'll probably be cool with it, but it's best to check. He seems like a big open-source kind of guy.

  6. #6
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I copied it first, then I understood how it worked, read up on eval() and made my own. I also made a precaching function and a object out of it.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer


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
  •