Log in

View Full Version : Defining own conditions?


DislexiK
03-05-2005, 10:21 PM
Good day,

I was wondering how one would define there own conditions, for example. If I were wanting to check to see if a value in a record in the database was 1 for example an attribute named: Gender, how would I go about making it so that in my templates I could just do:

<if gender="Male">
You're male
<else />
You're Female
</if>

How would I go about doing that?

The reason I ask, I need to set certain threads, posts and other settings different for specific forums, therefore I thought the best way would be to check the forum ID to see if it is an ID from an array, if it is then it will show a specific layout, otherwise show the default. So postbit would be like:

<if condition="blah">
Special postbit XHTML
<else />
Normal postbit XHTML
</if>

I am guessing for such a condition I would have to pre-define it (Where?) to basically check to see if the forum ID of the forum or thread/post is equal to one of the ID's in the array, if so return 1, in which case the above If else condition would be something like:

<if condition> <!-- If the forum ID is one in the array -->
Special postbit XHTML
<else />
Normal postbit XHTML
</if>

Please note, I wouldn't want to use this condition only in FORUMDISPLAY but Showthread and other template bits.

Thanks for your time

Regards

DislexiK

The Geek
03-05-2005, 10:48 PM
you should be able to try something like the following:

In phpinclude_start, do something like:
$myarray=array(34,21,1); //forumids

then in your templates try
<if condition="in_array($forumid,$myarray)">
stuff
<else />
other stuff
</if>

Just speaking off the cuff of course ;)

DislexiK
03-06-2005, 04:33 PM
Thanks GeeK