SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to use phplib tempaltes but use it twice. The reason is i want to be able to do something like

    <html>
    <body>
    <table width="%table_width%">
    <tr>
    <td>
    {template_2}
    </tr>
    </td>
    </table>

    let me explain.

    Basically, i want to use phplib templates as they are for including actual templates inside (and some things internal to the script) but also want to use replacment variables, a bit like VB does.

    %table_width% would thus be a replacement variable.


    Now... each replacement variable will be an a name indexed array and i would parse the whole lot through phplib at the start of the script so they can then be used.

    So what i really want is

    - a version of phplib that i can use to just parse this array of replacement variables. I am sure the template class could be shortened quite a lot for this.
    - a change of variable name so that %sfds% is the "template" name instead of {sdfsdf}
    - ensure that both {table} and %table% would work and call the appropriate things.

    Does that make sense to people? any suggestions?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Chris I am confused why not just use
    Code:
    <html> 
    <body> 
    <table width="{table_width}"> 
    <tr> 
    <td> 
    {template_2} 
    </tr> 
    </td> 
    </table>
    Why the need to try and use two differetn template systems here?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    couple of reasons. let me explain a bit more what i am doing

    the

    {something}

    tag will either refer to a name of a column in a database or another template. The script runs throught the columns (remember that bit you did for me) and passes all the info. The { } in the templates are then used. Otherwise it will be used for a template inside a template (although having this as a different tag system as well would be even better)

    I want to seperate { } for this function from the replacement variables, so at to avoid a conflict if they do overlap. I guess it is to keep them seperate in the mind of the person using them more than any real need to do it. but also means that {table} and %table% say won't cause a problem.


    on a side point freedy, have you any experience with the modified template class at:
    http://sourceforge.net/projects/phpwidgets/

    apparently it allows for conditionals inside templates. This would be cool, i use this in gossamer-threads template system you can do something like

    %if user="blah"%
    %template%
    %endif%

    i just wonder how they do it in this other place. I can't make head or tails of it.


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
  •