PDA

View Full Version : Simple Conditional Statement


samacohen
07-25-2004, 01:04 PM
Hello,

I'm slowly learning to manipulate the templates in vbulletin. There are two things I would like to do and was wondering if anyone can help. Please tell me if it is inappropriate to post this here, as I am new to all this

1) A conditional statement in a template
2) have it so announcements appear right in the forum, the way they do in invision power board

1)Conditionak Statement: I have altered templates so that certain templates call up html pages, so that they can display different sidebars for different sections. This is working just fine.

What I would like to now is to have the "Forum Display" template call up a specific template based on the forum ID #. And then if I don't have a specific template set for that forum id, it defaults to a standard one.

In other words it should be a conditional statement I place in the template, such as, in plain english

IF Forum ID = 1 then display $myfooter1
IF Forum ID =2 then display $myfooter2

Or Else diplay $myfooter_default

I just don't know the exact language

2) Announcement in forum

The second change, is that I would like to alter the forum display template so that instead of the announcement appearing as a link, the actual text of the anouncement appears instead. (It should not have the announement title, username, avatar, etc, of the person leaving the announcement, only the text of that announcement)

Thanks,
Sam

Modin
07-25-2004, 04:25 PM
a simple way to do this via templates with the first one. (normally I'd do it another way, but this way is simple to do)

Add the code to your forumdisplay template

<if condition="$forumid == 4">
stuff for forumid 4
</if>
<if condition="$forumid == 5">
stuff for forumid 5
</if>
<else>
default stuff
</if>

Colin F
07-25-2004, 04:31 PM
a simple way to do this via templates with the first one. (normally I'd do it another way, but this way is simple to do)

Add the code to your forumdisplay template

<if condition="$forumid == 4">
stuff for forumid 4
</if>
<if condition="$forumid == 5">
stuff for forumid 5
</if>
<else>
default stuff
</if>

You'd have to nest the conditionals for it to work with the else.


<if condition="$foruminfo[forumid] == 4">
stuff for forumid 4
<else />
<if condition="$forumid == 5">
stuff for forumid 5
<else />
default stuff
</if>
</if>

Modin
07-26-2004, 12:25 AM
yeah, that's the more efficient way ;)

though if efficiency is the goal I'd do it in php as oppose the vb template conditionals.