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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2008, 12:20 PM
BrotherX BrotherX is offline
 
Join Date: Sep 2007
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to made if and else in vbulletin?

Hello, I want to put code in postbit so that I am able to have in some specific forums banners but when I don't have them (too many) than one common banner or message. Thanx in advance.

So here is the code and explanation inside that code:
Code:
OPTION I

<if condition="!in_array($forumid, array(FORUMID1))">

    <td class="alt1" align="center">
        <div>
<a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="banner_path.jpg" border="0" alt="$vboptions[bbtitle]" /></a></td>
<if />

OPTION II

<if condition="!in_array($forumid, array(FORUMID2))">

    <td class="alt1" align="center">
        <div>
<a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="banner_path.jpg" border="0" alt="$vboptions[bbtitle]" /></a></td>
<if />

IF NOT OPTION I AND OPTION II, THAN GENERAL OPTION

<if condition="!in_array($forumid, array(ANY OTHER FORUM ID))">

    <td class="alt1" align="center">
        <div>

MARKETING

        </div>
    </td>
<if />
Reply With Quote
  #2  
Old 02-16-2008, 01:13 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure what you are asking really but is this what you want:
Code:
<if condition="in_array($forumid, array(1, 2, 3))">
	Displayed to users in forum 1, 2 & 3
<else />
	<if condition="in_array($forumid, array(4, 5, 6)">
		Displayed to users in forum 4, 5 & 6
	<else />
		Displayed to everyone who is NOT in forum 1, 2, 3, 4, 5 or 6
	</if>
</if>
Reply With Quote
  #3  
Old 02-16-2008, 01:22 PM
BrotherX BrotherX is offline
 
Join Date: Sep 2007
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, I want to display different banners for different forums, no different user groups.

Banner 1 for forumID35
Banner 2 for forumID67
...
Banner 5 for forumID32
Banner 6 for all other forum ID's on my forum

So we need command else and if. I know something about that, but I don't have idea how to made that in vbulletin.

I want to display different banners on different forums, so I have few banners (for example 5) and I want every banner for one forum. So five banners for five forums. Now becouase I have more than for example 50 forums, for rest I want to display one general banner, so when users are on the forums which don't have own banner (from group of the 5 banners) I want to display one general banner.
Reply With Quote
  #4  
Old 02-16-2008, 01:26 PM
Guest210212002
Guest
 
Posts: n/a
Default

Ops has it right, if I get your meaning. Use the first conditional to show your forum specific banners (if condition = forum 1/2/3), else show the default banner.
Reply With Quote
  #5  
Old 02-16-2008, 02:17 PM
BrotherX BrotherX is offline
 
Join Date: Sep 2007
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris-777 View Post
Ops has it right, if I get your meaning. Use the first conditional to show your forum specific banners (if condition = forum 1/2/3), else show the default banner.
I know that, will you give me specific code, becouase that is what I don't know in vbulletin, I don't know how shell I write specific code if and else? Jst take code from first post and made if and else how must be. Thanks.

Option I for forumid1

if not

Option II for forumid2

if not

Option III for forumid3

if not GENERAL OPTION for rest of the forums
Reply With Quote
  #6  
Old 02-16-2008, 02:26 PM
Guest210212002
Guest
 
Posts: n/a
Default

The code is in Opserty's post man.
Reply With Quote
  #7  
Old 02-16-2008, 02:42 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It it all in my post... I can't understand what you don't get...
Quote:
Option I for forumid1

if not

Option II for forumid2

if not GENERAL OPTION for rest of the forums
Code:
<if condition="$forumid == 1">
	Displayed to users in forum 1
<else />
	<if condition="$forumid == 2">
		Displayed to users in forum 2
	<else />
		Displayed to everyone who is NOT in forum 1 or 2
	</if>
</if>
I match up colours...does it make sense now?:erm:
Reply With Quote
  #8  
Old 02-16-2008, 04:27 PM
cheesegrits's Avatar
cheesegrits cheesegrits is offline
 
Join Date: May 2006
Posts: 500
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Except that the "Displayed to ..." text now doesn't match the conditions.

-- hugh
Reply With Quote
  #9  
Old 02-16-2008, 04:34 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

~ Edited.
Reply With Quote
  #10  
Old 02-17-2008, 09:40 AM
BrotherX BrotherX is offline
 
Join Date: Sep 2007
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
It it all in my post... I can't understand what you don't get...

Code:
<if condition="$forumid == 1">
	Displayed to users in forum 1
<else />
	<if condition="$forumid == 2">
		Displayed to users in forum 2
	<else />
		Displayed to everyone who is NOT in forum 1 or 2
	</if>
</if>
I match up colours...does it make sense now?:erm:
No, it is not that. It allways show me third (general option), even on forumid1 and forumid2? So I suppose error is in third option, where must be condition for rest of the forums (id) AND it must exclude forum id 1 and forum id 2.

How is now I think that code displey banner from third (general) option on all forums, even on forum id 1 and forum id 2?
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 08:30 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.05112 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
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
  • (4)bbcode_code
  • (3)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
  • (8)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_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