vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Advanced Templates: Dynamic Templates Changing according to different conditions (https://vborg.vbsupport.ru/showthread.php?t=43325)

Logician 09-10-2002 08:19 AM

Quote:

Originally posted by Abbas
Using conditionals will it be possible to have separate templates for categories of forums? Or will you have to have a conditional for each forum in that category. I'm basically going to aim to have separate sections of my forum with different graphical styles etc.

I cant say anything before knowing what exactly you have in your mind but in the first look yes it seems you can do it via conditionals. The hack does not allow you to create multiple templates for one, but by using a conditional trick you can create multi-templates inside one template:

Example:
PHP Code:

[[(($bbuserinfo[userid]==1))]]
Your HTML codes if user's userid is 1
[[/(($bbuserinfo[userid]==1))]]
[[(!($bbuserinfo[userid]==1))]]
Your HTML codes if user'
s userid is NOT 1
[[/(!($bbuserinfo[userid]==1))]] 

So as you see we have one template but within it we actually have two, each of which will be displayed according to user's userid. (Notice ! sign which is used like "else")

However I might say that if you are trying to apply different styles for different forums you dont need a hack, you can do it by configuring your forum styles.. I believe you already know that?

Abbas 09-10-2002 08:29 AM

Thanks for that info. Yeah I know different styles can be done without hacks, but there may be different templates involved not just graphical styles alone, e.g. our gaming forums may have other templates for clan and multiplayer stuff etc...

-Abbas

AndrewD 09-10-2002 06:41 PM

Does this work ok with 2.2.6? I installed it as per instruction but conditional tests simply get reflected back unchanged.

I tried the advanced_functions code as a stand alone and it seems fine. Perhaps I've made a silly mistake somewhere ;)

Logician 09-10-2002 08:07 PM

Quote:

Originally posted by AndrewD
Does this work ok with 2.2.6? I installed it as per instruction but conditional tests simply get reflected back unchanged.

I tried the advanced_functions code as a stand alone and it seems fine. Perhaps I've made a silly mistake somewhere ;)

yes it works with all vb versions I know.. Have you uploaded the file to your server? :)

More likely your condition didnt apply so it wasnt parsed. What condition did you test and where?

Martin CX 09-10-2002 08:10 PM

Wow! I can't wait to try this out!

/me clicks install button

AndrewD 09-11-2002 05:58 AM

Sorted out my problem re conditionals not getting parsed.

gettemplate actually contains two return statements - the first executed only if you have enabled template debugging. I had this option enabled, so the call to advanced_templates was not being made.

you need to make the following change to gettemplate

PHP Code:

 if ($gethtmlcomments and $addtemplatename) {
return 
advanced_templates(
"<!-- BEGIN TEMPLATE: $templatename -->\n$template\n<!-- END TEMPLATE: $templatename -->"
);   }   
return 
advanced_templates($template); 

Great job, thanks

memobug 09-12-2002 11:28 PM

This looks great! I have two questions with how it might work:

1) Is the html between the conditionals parsed, that is if I use a variable name in the html there will it be replaced with its value or will it stay as-is?

2) Can I put a "virtual include" in there in the html conditional? I've done this before using php-include template, but I'm wondering if I can get around that.

Many thanks,

Matt

Logician 09-13-2002 08:11 AM

Hi Matt,
Quote:

Originally posted by memobug
1) Is the html between the conditionals parsed, that is if I use a variable name in the html there will it be replaced with its value or will it stay as-is?

2) Can I put a "virtual include" in there in the html conditional? I've done this before using php-include template, but I'm wondering if I can get around that.

The parsing of templates does not change after you installed the hack. So you can answer all your questions according to this fact: Your advanced template would exactly do the same parsing if it was a normal vb template. :)

The hack only checks the template if there is special conditional tags inside and acts like this:
a) if the template does not include any conditional, it takes no action and returns the entire template just like a normal vb. template.
b) If the template has conditionals, the hack checks them one by one and
ba) if condition is FALSE, it deletes this condition (and its HTML code in between) from the template, as if it never existed in the template
bb) If condition is TRUE, it deletes only the condition tags and keeps the condition's HTML code in between so that it will be parsed.

As you see it does not interfere with vb's default template processing in anyway..

Hope this helps..

Koss 09-16-2002 08:27 AM

hi

will this edit all my style templates if I just edit the template of one style?

thanks

Logician 09-16-2002 11:09 AM

Quote:

Originally posted by Koss

will this edit all my style templates if I just edit the template of one style?

I am not sure if I got the question correctly? After you installed the hack nothing changes in your board unless you apply a conditional to any template in any style set. After the installation, your templates will behave just exactly how they behave before and you'll NOT notice any difference in their display or something. However from now on you will be able to apply a conditional to any template in your database. Ie. your default templates in any style sheet, your custom templates, the templates the hacks you installed created, just anything. Whenever you add a conditional to any template, this template will be displayed according to this conditional. This is how this hacks works and I hope it answers your question too..


All times are GMT. The time now is 12:41 PM.

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.01455 seconds
  • Memory Usage 1,751KB
  • 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
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete