Results 1 to 3 of 3

Thread: XTemplate..PHP

  1. #1
    Join Date
    Aug 2000
    Posts
    2,754

    XTemplate..PHP

    Hi,

    I've never used this before and didn't think it would be so awkwad however i'm trying to execute the following from a .html file:

    PHP Code:
    if(row.premium_show == '1'
    {
     echo 
    '<tr bgcolor="#fdd2b0">'
       } else {
     echo 
    '<tr>';

    The system uses http://www.phpxtemplate.org/HomePage

    But I just cannot simply figure out howto get it to use that code within the template, anyone able to help?

  2. #2
    Join Date
    Jun 2003
    Location
    Proud She-Geek
    Posts
    1,723
    With most template parsers you would not have to use echo statements; part of their job is to allow you to use straight html + template tags in the templates.

    Most template parsers allow you to do something like
    Code:
    {if row.result == something}
    output for when row.result == something
    {else}
    output for everything else
    {/if or endif}
    I didn't see an actual example of this on phpxtemplate's website nor in the documentation of their download; perhaps looking around in the template class file may reveal the exact syntax?

    HTH
    <?php echo "Signature here"; ?>

  3. #3
    Join Date
    Aug 2000
    Posts
    2,754
    Hi,

    Thanks i've tried this:

    PHP Code:
    {if row.premium_show == }
    <
    tr bgcolor="#fdd2b0">
       { else }
     <
    tr
       {/endif} 
    But it just does both, doesn't check anything..

    Don't know if this helps but this is some syntax i've taken from the .html files..

    PHP Code:
     <form action="{PHP._SERVER.PHP_SELF}" method="get"
    PHP Code:
     <option value="{x.value}" {x.selected}>{x.text}</option
    This is the first time i've used templates in this way so I maybe missing something really obvious....

Posting Permissions

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