Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #51  
Old 05-20-2010, 07:38 PM
kjsmith84 kjsmith84 is offline
 
Join Date: Sep 2009
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BRotondi View Post
? Seen the last post before yours ?
tried that and it didnt work.

tried it again and seems to work now- must have missed something

<if condition="in_array($foruminfo['forumid'], array(110,149,150))">images/evid_blue/gradients/SXS411.PNG<else />
Reply With Quote
  #52  
Old 05-20-2010, 08:33 PM
BRotondi BRotondi is offline
 
Join Date: Sep 2008
Location: Zurich
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

He he. It also happens often to me: Try, try, try... ask... then it works and I never get, what went wrong before .

Nice it works now!
Reply With Quote
  #53  
Old 02-02-2012, 02:45 PM
carolc carolc is offline
 
Join Date: Oct 2009
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad I found this thread as it should get me part of the way there.

How can I show a different logo based on the date? (kind of like what Google does on holidays). So if the date = July 4th show one banner, else if the month = October show another banner, etc. I don't want to hardcode the years, though, since I'd like this code to work year after year. Is this too resource intensive?

Also a general php question for those who also know C/C++/C#... does php have Case statements?

Thanks
Reply With Quote
  #54  
Old 02-02-2012, 03:01 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by carolc View Post
Glad I found this thread as it should get me part of the way there.

How can I show a different logo based on the date? (kind of like what Google does on holidays). So if the date = July 4th show one banner, else if the month = October show another banner, etc. I don't want to hardcode the years, though, since I'd like this code to work year after year. Is this too resource intensive?
I don't think an 'if' on the date would be resource-intensive. But I don't believe there's a variable that includes just the date, and you are limited in which php functions you can call in a condition (https://www.vbulletin.com/docs/html/...n_conditionals), so you'd probably need a plugin.

Quote:
Also a general php question for those who also know C/C++/C#... does php have Case statements?
Yes, it's called switch. http://us2.php.net/manual/en/control...res.switch.php
Reply With Quote
  #55  
Old 02-02-2012, 04:22 PM
carolc carolc is offline
 
Join Date: Oct 2009
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I don't think an 'if' on the date would be resource-intensive. But I don't believe there's a variable that includes just the date, and you are limited in which php functions you can call in a condition (https://www.vbulletin.com/docs/html/...n_conditionals), so you'd probably need a plugin.
Thank you, I will go do some research on writing plugins. Would you know what hook location I might need to use? I'm sure having that as a keyword will help me get better search results.


Quote:
Originally Posted by kh99 View Post
Awesome... It's nice to see something familiar (as I struggle to learn php). Could switch/case have been used for some of the earlier examples in this thread (if they wanted more if/else conditions) or can it not be used in templates?
Reply With Quote
  #56  
Old 02-02-2012, 04:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by carolc View Post
Thank you, I will go do some research on writing plugins. Would you know what hook location I might need to use? I'm sure having that as a keyword will help me get better search results.
If the logo is in the header template then you probably want to use the parse_templates hook. The best thing to do when deciding on a hook is to look in the code. It helps to have the code on your location computer and set it up so that you can search across all files. Then you can search for a hook location, for instance, and look to see what can be dome at that location and which variables are available.


Quote:
Awesome... It's nice to see something familiar (as I struggle to learn php). Could switch/case have been used for some of the earlier examples in this thread (if they wanted more if/else conditions) or can it not be used in templates?
You pretty much only have 'if' available in a template.
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 04:39 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04161 seconds
  • Memory Usage 2,237KB
  • Queries Executed 14 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_postinfo_query
  • fetch_postinfo
  • 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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete