vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   custom code in vanbar based on forum id (https://vborg.vbsupport.ru/showthread.php?t=283655)

sailnet 05-29-2012 07:26 PM

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.

Lynne 05-29-2012 08:15 PM

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.

sailnet 05-29-2012 08:23 PM

Quote:

Originally Posted by Lynne (Post 2334439)
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 (Post 2334439)
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>

Lynne 05-30-2012 12:41 AM

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)

Simon Lloyd 05-30-2012 02:57 AM

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>


sailnet 05-30-2012 12:34 PM

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>

Simon Lloyd 05-30-2012 01:59 PM

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.

sailnet 05-30-2012 02:11 PM

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.

Simon Lloyd 05-30-2012 03:48 PM

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>


sailnet 05-30-2012 03:56 PM

mucho gracias!


All times are GMT. The time now is 11:26 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.01279 seconds
  • Memory Usage 1,739KB
  • 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_html_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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