Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2012, 07:26 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default custom code in vanbar based on forum id

I have several forums where I'd like to display a certain graphic under the navbar for specific forum id's.

how can this be done?

I'm sure it's possible I just don't know how.

thanks in advance.
Reply With Quote
  #2  
Old 05-29-2012, 08:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

for forum 1, use an image like "myimage1.png" and for forum 2, use "myimage2.png", etc. Then you can just change the 1,2 in the image name depending on the forumid.
Reply With Quote
  #3  
Old 05-29-2012, 08:23 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
for forum 1, use an image like "myimage1.png" and for forum 2, use "myimage2.png", etc. Then you can just change the 1,2 in the image name depending on the forumid.
I understand that but how do I write the code that goes inside the template.

can I write this?

<if condition $foruminfo[forumid] = 'n'>

some statements

</if>

--------------- Added [DATE]1338326940[/DATE] at [TIME]1338326940[/TIME] ---------------

Quote:
Originally Posted by Lynne View Post
for forum 1, use an image like "myimage1.png" and for forum 2, use "myimage2.png", etc. Then you can just change the 1,2 in the image name depending on the forumid.
I understand that but how do I write the code that goes inside the template.

can I write this?

<if condition $foruminfo[forumid] = 'n'>

some statements

</if>
Reply With Quote
  #4  
Old 05-30-2012, 12:41 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, just write:

HTML Code:
<vb:if condition="in_array($forum[forumid], array(x,y,z))">
<img src="myimage{vb:raw forum.forumid}" alt="" />
</vb:if>
(I'm not sure that variable will work - it depends on what template you put the code in)
Reply With Quote
  #5  
Old 05-30-2012, 02:57 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne, you're lost in vb4
try
HTML Code:
<if condition=""in_array($forum[forumid], array(x,y,z))">
<img src="myimage"+$forum[forumid] alt="" />
</if>
Reply With Quote
  #6  
Old 05-30-2012, 12:34 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm on vb 3.84 - I did find that this work fine for me also.

<if condition="$foruminfo['forumid'] == 55">
<h1>this is a test</h1>
</if>
Reply With Quote
  #7  
Old 05-30-2012, 01:59 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That will work but you wanted to call an image not just show text, if you name your images whateverxx where xx would be the forumid that they would show for my code (and indeed Lynnes for VB4) should display the right image for the right forum.
Reply With Quote
  #8  
Old 05-30-2012, 02:11 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks simon - my basic challange is that on certain forums I need to display one graphic at the top - on all other forums I need to include from google code that display s a banner ad from google.

so I'm having a little trouble with the structure of the code to test for multiple forum id and display a unique graphic for each of the 'special' forum id's ELSE display the google ad.

--------------- Added [DATE]1338390824[/DATE] at [TIME]1338390824[/TIME] ---------------

My guess is that I am face with this code.

<if condition="$foruminfo['forumid'] == 55">
display image1
else <if condition="$foruminfo['forumid'] == 155">
display image2
else <if condition="$foruminfo['forumid'] == 159">
display image3
else
insert my google ad code here.
Reply With Quote
  #9  
Old 05-30-2012, 03:48 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It would be
HTML Code:
<if condition="$foruminfo['forumid'] == 55">
<img src="/mypicturepath/mypic1" /></if>
<else />
<if condition="$foruminfo['forumid'] == 155">
<img src="/mypicturepath/mypic2" /></if>
<else /> <if condition="$foruminfo['forumid'] == 159">....etc </if>
Reply With Quote
  #10  
Old 05-30-2012, 03:56 PM
sailnet sailnet is offline
 
Join Date: Oct 2009
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

mucho gracias!
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:42 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.04592 seconds
  • Memory Usage 2,249KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_html
  • (2)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
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)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
  • 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