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 05-23-2013, 07:34 PM
mindhunter77 mindhunter77 is offline
 
Join Date: Jan 2006
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [forumid] Being Ignored

I'm new to this so I apologize ahead of time.

I'm trying to make a simple plugin that will just display some text based on forum id.

The plugin is almost working, but it seems that [forumid] is being ignored as it is showing across all forums, not just the forum that is listed.

Plugin Code
Code:
ob_start();
include('/media/data/vhosts/site.com/htdocs/forum/headings.php');
$cw_h2 = ob_get_contents();
ob_end_clean();
PHP FILE CONTENTS
Code:
<if condition='$thread[forumid] == 237'><div align="center"><h2>Some Text</h2></div></if>
It displays when I reference $cw_h2 in a template, but problem is it displays in all forums, not just forum 237.
Reply With Quote
  #2  
Old 05-23-2013, 10:47 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm confused by what you posted - the second one says "php file contents" but it looks like a template. If it's not a template then you can't use <if condition=...
Reply With Quote
  #3  
Old 05-23-2013, 11:28 PM
mindhunter77 mindhunter77 is offline
 
Join Date: Jan 2006
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well it's if condition not if contents=

I'm new at this so probably wrong, but the idea is just to display something on forumdisplay page.
Reply With Quote
  #4  
Old 05-23-2013, 11:31 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Those are vb template if conditionals that can't be used in your PHP file.

Your PHP FILE is executed AS IS (outside of vBulletin's everything) and its output is assigned to your variable.


You don't even need a plugin for this, just plop your code into the header template. I'd change $thread to $GLOBALS though instead.


If you were going to do it in php, you'd need to do a bunch of stuff to get into vBulletin, and then you'd have to do some php:

PHP Code:
if ($foo == bar) {echo "something stupid";} 
But you're not inside of the scope of vBulletin, so you can't use vBulletin variables
Reply With Quote
  #5  
Old 05-23-2013, 11:38 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mindhunter77 View Post
Well it's if condition not if contents=
lol, you're right of course, my brain was somewhere else...

Anyway, I see now what you meant - the php file you're refering to is headings.php. As Zachery explained, you don't need the plugin, you just need to put that code in the template.
Reply With Quote
  #6  
Old 05-23-2013, 11:46 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

To be more clear, plop this into your header template


Code:
<if condition="$GLOBALS[forumid] == 237">
     <div align="center">
          <h2>Some Text</h2>
     </div>
</if>
Reply With Quote
  #7  
Old 05-24-2013, 04:42 PM
mindhunter77 mindhunter77 is offline
 
Join Date: Jan 2006
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea, I was using this opportunity to see how small mods are made, but your right, I'll just stick it right in the template. I'm just concerned which way to do it would be better, as there are going to be about thirty of them lol
Reply With Quote
  #8  
Old 05-24-2013, 05:17 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could use this https://vborg.vbsupport.ru/showthread.php?t=286403 and just expand it to as many boxes (and variables) as you need, you can put all of Zacherys' code in the boxes and have it displayed wherever you put the variables
Reply With Quote
  #9  
Old 05-24-2013, 05:22 PM
mindhunter77 mindhunter77 is offline
 
Join Date: Jan 2006
Posts: 194
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually I may play around with that, thanks.
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:49 AM.


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.02394 seconds
  • Memory Usage 2,239KB
  • 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
  • (3)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete