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 10-17-2002 06:03 PM

Quote:

Originally posted by Mist
Cuz im my forumdisplay template i want to have one template for a specific forum and i want the default template to apply for the rest... Im sick of doing this with extra styles and assigning a forum a specific style set as it gets too confusing

What you need is this:

PHP Code:

[[($forumid==2)]]
This will be the template for the forums whose id is 2
[[/($forumid==2)]]
[[(
$forumid!=2)]]
This will be the template for the forums whose id is NOT 2
[[/($forumid!=2)]] 


Dean C 10-18-2002 05:24 PM

lol why didn't i think of the " != "

Thanks buddy

- miSt

HappyPike 10-18-2002 07:50 PM

hey Logician,

Can this hack be use to hide or show certain features such as avatars depending on current server load? If yes, what's the conditionals for that?

Thanks! This is a really useful hack!

Logician 10-18-2002 08:03 PM

Quote:

Originally posted by HappyPike

Can this hack be use to hide or show certain features such as avatars depending on current server load? If yes, what's the conditionals for that?

As it is, no.

But if you can add another hack which will assign the server load (or anything you like) to a global variable (like in global.php) then yes it can. After you assign the variable value, you should edit postbit template and find the avatar variable (was it $post[avatar] ?) and replace it with this code:

PHP Code:

[[($yourvariable<x)]]
$post[avatar]
[[/(
$yourvariable<x)]] 

Now avatars would be displayed only when $yourvariable is less than x.

EDIT: BTW. do not forget that this may not help much since the template modifications is just about the visual design. That is, your db would be still queried for the avatar in this example but just not displayed to the end user inside your template. So it wouldnt help decreasing server load much.. just the bandwidth maybe :)

John 10-19-2002 06:19 PM

Logician - you genius!!

You would not believe the work this hack has saved me, and I installed it in under a minute!

Thanks!

pool-werbung 10-27-2002 07:18 PM

Can i use a condition of the ip of the user? Is there a var that in it is the user-ip?

NTLDR 10-27-2002 07:45 PM

You could try using:

PHP Code:

$HTTP_SERVER_VARS[REMOTE_ADDR

No idea if it will work, or if any of the $HTTP variables will work with this hack without modification. I'm sure Logician can shed some light though ;)

Logician 10-27-2002 10:19 PM

NTDLR's method should work.. The hack is compatible with ALL variables in the memory so if I guess $HTTP_SERVER_VARS[REMOTE_ADDR] will work..

Also vb saves user's IP address in "$ipaddress" variable in global.php, so $ipaddress should work too.

However I'm sure you are well aware that IP address is not a good mainstay for conditionals since many users have dynamic IP.

JakeC 10-29-2002 02:49 AM

Excellent Hack! Now even I can feel like a power user!!

JakeC

Bandit 11-02-2002 02:05 AM

I installed this hack and all of a sudden my forums started to show the default templates for every style I have. The template is still the same (in the user cp), but my forums just show the default one... I tried uploading the old functions.php but it did not fix the problem. Any ideas??


All times are GMT. The time now is 07:59 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.01399 seconds
  • Memory Usage 1,744KB
  • 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
  • (3)bbcode_php_printable
  • (2)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