Announcement

Collapse
No announcement yet.

Conditional Template Tags

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • merk
    replied
    Originally posted by The Keeper
    I don't seem to be having any luck with this. I tried testing it out with code like this:

    Code:
     
    <if condition="$usergroupid > 5">
    <span class="smallfont">Mods and Admins See this</span>
    </if>
    However the text won't show?
    $usergroupid isnt available. What template are you trying to do it in? If its for the user that is viewing the board, it will be $bbuserinfo[usergroupid].

    Leave a comment:


  • The Keeper
    replied
    Originally posted by Freddie
    Downward compatibility is rather pointless since every vB 3.0 template will be different than a vB 2 template. They are either (a) renamed, (b) removed or (c) condensed. For example, there is only one template for all of the mod actions that can be performed on a thread. Each action is handled by a conditional.

    Yes you can next conditions.

    Yes, you can use < and > since it is the quotes that start and end of the condition.

    <if condition="$usergroupid > 3">
    ...
    </if>
    I don't seem to be having any luck with this. I tried testing it out with code like this:

    Code:
     
    <if condition="$usergroupid > 5">
    <span class="smallfont">Mods and Admins See this</span>
    </if>
    However the text won't show?

    Leave a comment:


  • Cyborg from DH
    replied
    or:

    <if condition="$currencysign = '$'">...</if>

    Leave a comment:


  • MiF
    replied
    Originally posted by Cyborg from DH
    how do you handle other double-quotes in conditional tags:

    <if condition="$name=="hello"">...</if>

    does this work:

    <if condition="$name==\"hello\"">...</if>


    ??

    How about these:

    <if condition='$currencysign == "\$"'>...</if>
    <if condition="$currencysign == \"\\$\"">...</if>

    Are the above two written correctly to test for $?

    Leave a comment:


  • Cyborg from DH
    replied
    how do you handle other double-quotes in conditional tags:

    <if condition="$name=="hello"">...</if>

    does this work:

    <if condition="$name==\"hello\"">...</if>


    ??

    Leave a comment:


  • MiF
    replied
    Originally posted by freddie
    Downward compatibility is rather pointless since every vB 3.0 template will be different than a vB 2 template. They are either (a) renamed, (b) removed or (c) condensed. For example, there is only one template for all of the mod actions that can be performed on a thread. Each action is handled by a conditional.
    Personally I think downward compatability would help people who write their own templates. This way they can write a template that works for 3+ and sub 3 versions.

    Another question though.

    Would it be better to use tags that do not require closing tag?

    <if />
    <else />
    <endif />

    Rather than using </if>. Could you end up with some invalid HTML code when you test your templates without conditional preprocessor?

    Leave a comment:


  • Freddie Bingham
    replied
    Downward compatibility is rather pointless since every vB 3.0 template will be different than a vB 2 template. They are either (a) renamed, (b) removed or (c) condensed. For example, there is only one template for all of the mod actions that can be performed on a thread. Each action is handled by a conditional.

    Yes you can next conditions.

    Yes, you can use < and > since it is the quotes that start and end of the condition.

    <if condition="$usergroupid > 3">
    ...
    </if>

    Leave a comment:


  • MiF
    replied
    Originally posted by Icheb
    And why exactly is this so important?
    Because I have written a conditional processor in my 2.2.9 board and will change it to match 3.0 conditionals if possible.

    Leave a comment:


  • MiF
    replied
    Looks like you got a bug. The exlamation point does not show up in the html code I posted.

    Leave a comment:


  • MiF
    replied
    So, you do not plan to make downward compatible conditionals?

    I suspect not everyone will upgrade to 3.0 right away and it would be good to allow hack writers downward compatibility for templates

    For example:

    HTML Code:
    <if condition="$usergroupid==6">
    Administrator
    <else />
    Non administrator
    </if>
    Will display both cases in sub 3.0 release which is not desirable.

    Would it be possible to allow conditional tags to suppost comments?

    For example allow it to be written as:

    HTML Code:
    <!--if condition="$usergroupid==6" />
    Administrator
    <else />
    Non administrator
    <endif /-->
    Or

    HTML Code:
    <!--if condition="$usergroupid==6" />
    Administrator
    <else /-->
    Non administrator
    <endif />

    Couple of more questions I have.

    How do you test for greater than or less than condition? I don't think > and < will work even if part of a property.

    Also, can you have nested conditions? If not, I would like to request that you implement them.
    Last edited by MiF; Wed 19 Feb '03, 5:10pm.

    Leave a comment:


  • Wayne Luke
    replied
    What will "they" be named?

    There is the <if> conditional tag... It includes a closing tag of </if> and an intermediate tag of <else>... Not really sure it needs another name.

    Leave a comment:


  • Icheb
    replied
    I wasn't refering to the templates, I meant the question this thread is based upon .

    Leave a comment:


  • Floris
    replied
    You can do a lot with just conditionals, most source code hacks become obsolete Saves a lot of upgrade headaches for some.

    Leave a comment:


  • Icheb
    replied
    And why exactly is this so important?

    Leave a comment:


  • Floris
    replied
    HTML Code:
    <table>
    <tr>
    <if condition="$vboptions['$vbversion'] != 3.0">
    <td>.. We will wait some more ..</td>
    <else />
    <td>.. Extasy ..</td>
    </if>
    </tr></table>
    w00t

    Leave a comment:

Related Topics

Collapse

Working...
X