vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Defining own conditions? (https://vborg.vbsupport.ru/showthread.php?t=77560)

DislexiK 03-05-2005 10:21 PM

Defining own conditions?
 
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


All times are GMT. The time now is 08:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01188 seconds
  • Memory Usage 1,708KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete