Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by dp  (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 06-28-2001 Last Update: Never Installs: 0
 
No support by the author.

Hi,

maybe you know that problem, just checking if $foo isset, if not dont display option $bar.

this is kinda nasty cuz you gotta edit the .php file and the template.

i've thought about conditional templates and wrote that extremly short hack:

./admin/functions.php

before
PHP Code:
if ($gethtmlcomments and $addtemplatename) { 
paste this
PHP Code:
$template=str_replace('?','"',$template); 
this will replace every ?-char with " but it will NOT escape this quote char!

from now on you can use the iif() function:

Template:
Code:
... this user has ? . iif($userposts == 1, ?one post?, ?$userpost posts?) . ? since ...
actually it will look like this after beeing parsed:
Code:
... this user has " . iif($userposts > 0, "not a single post", "$userpost posts") . " since ...


well thats not easy to explain, i hope you got then point

note this isnt tested very well, use with care!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-15-2002, 12:49 AM
mwagstaff mwagstaff is offline
 
Join Date: Feb 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome! This is just what I've been looking for for a long time. Fantastic work! From my quick-and-dirty testing, this appears to be the answer to my conditional templates dreams...
Reply With Quote
  #3  
Old 08-15-2002, 08:17 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what is the point of this :S?
Reply With Quote
  #4  
Old 08-15-2002, 11:35 AM
mwagstaff mwagstaff is offline
 
Join Date: Feb 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It allows you to include conditional statements in your templates. For example, on my site which is PDA-oriented, I want to display a different layout if a visitor is using a PDA browser (e.g. Pocket Internet Explorer), which obviously has a lot less screen space to play with.

Therefore, I would include a conditional check to see whether a PDA browser is detected or not before deciding which elements of the template to display, and what the layout should be.
Reply With Quote
  #5  
Old 08-15-2002, 11:44 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Conditional templates will be a feature of vb3....
Reply With Quote
  #6  
Old 08-15-2002, 11:45 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I still don't get it. Any examples of this in use?

Quote:
Originally posted by mwagstaff
It allows you to include conditional statements in your templates. For example, on my site which is PDA-oriented, I want to display a different layout if a visitor is using a PDA browser (e.g. Pocket Internet Explorer), which obviously has a lot less screen space to play with.

Therefore, I would include a conditional check to see whether a PDA browser is detected or not before deciding which elements of the template to display, and what the layout should be.
Reply With Quote
  #7  
Old 08-15-2002, 11:53 AM
mwagstaff mwagstaff is offline
 
Join Date: Feb 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm still checking, but it appears that the conditional check doesn't work correctly in the postbit templates - the result always comes up as false.
Reply With Quote
  #8  
Old 08-20-2002, 12:50 AM
mwagstaff mwagstaff is offline
 
Join Date: Feb 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone know what's so special about the postbit templates that they set all variables to null?

For example, if I set a variable $mobile to 1, it will be recognised as such in the showthread template. In the postbit template, however, it always comes up as null (even if I include a php file in the postbit template that specifically sets it to 1).
Reply With Quote
  #9  
Old 08-22-2002, 04:20 PM
Entourage Entourage is offline
 
Join Date: Apr 2002
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by mwagstaff
Anyone know what's so special about the postbit templates that they set all variables to null?

For example, if I set a variable $mobile to 1, it will be recognised as such in the showthread template. In the postbit template, however, it always comes up as null (even if I include a php file in the postbit template that specifically sets it to 1).
Yes the variables are shipped to another php file (postbit is parsed in /admin/functions.php)
Reply With Quote
  #10  
Old 08-22-2002, 05:15 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it's because getpostbit is a real function, so it doesn't use variables from showthread.php
you have to globalize your variable first
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:56 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.04582 seconds
  • Memory Usage 2,291KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_imicons
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete