Announcement

Collapse
No announcement yet.

Conditionals in Custom Templates

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

  • Conditionals in Custom Templates

    I'm trying to reorganize my template modifications so I followed the instructions from this thread.

    The template was successfully called, however, I noticed that my conditionals are no longer working. Here's one example:

    Code:
    	<if condition="$show['member']">
    		<td class="desktop" valign="middle" width="12%" bordercolor="#FFFFFF">
    		 <span><a href="$vboptions[bburl]/usercp.php?$session[sessionurl]"><img src="$vboptions[bburl]/../images/forums/minimalist/custom/settings.gif" border="0"><br>Settings</a></span>
    		</td>
    	</if>
    	<if condition="$show['member']">
    	<else />
    		<td class="desktop" valign="middle" width="12%" bordercolor="#FFFFFF">
    		 <span><a href="$vboptions[bburl]/usercp.php?$session[sessionurl]"><img src="$vboptions[bburl]/../images/forums/minimalist/custom/login.gif" border="0"><br>Login</a></span>
    		</td>
    	</if>
    Any ideas?

  • #2
    The phpinclude_start template is evaluated before the rest of the SHOWTHREAD content, so many of the variables in the SHOWTHREAD template won't work in your custom template.

    Comment


    • #3
      I'm actually trying to do this in the navbar template, but since its not working I'm assuming its the same as SHOWTHREAD.

      Is there any way to use these conditionals/variables in custom templates?

      Comment


      • #4
        This conditional should work for what you want to do in that template:

        Code:
        <if condition="$bbuserinfo[userid]">
        	STUFF THAT IS SHOWN TO REGISTERED USERS
        </if>
        This condition uses the $bbuserinfo[] array which is available to the phpinclude_start template. This condition will evaluate to true for all registered users.

        Template conditionals work in all templates. The variables used in those conditionals vary with each template and where it is called. When you call a template from the phpinclude_start template, you are mostly limited to vBulletin and PHP globals. Many of the $show[] variables are declared later on, after the phpinclude_start template is evaluated.

        Comment


        • #5
          Genius.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X