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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2008, 07:14 AM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Include File in Template

I have a piece of code that is only suppose to run when the $denyadminip is put into a template. For some reason it is running everywhere on the forums. I know I set it to global, but it should only run when I put $denyadminip. Anyway here is the code:
Code:
<hookname>global_start</hookname>
<phpcode><![CDATA[ob_start();
include('allowip.php');
$denyadminip = ob_get_contents();
ob_end_clean();]]></phpcode>
Reply With Quote
  #2  
Old 07-29-2008, 07:50 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Plugins are always run depending on their hook location, changing what is in the template has no effect on a plugin. Change the hook location if you want to change when/where a plugin is execute.

$denyadminip is just the output and nothing else.
Reply With Quote
  #3  
Old 07-29-2008, 08:44 PM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
Plugins are always run depending on their hook location, changing what is in the template has no effect on a plugin. Change the hook location if you want to change when/where a plugin is execute.

$denyadminip is just the output and nothing else.
Is there a way to include a php file and then making it execute by putting $denyadminip in it?
Reply With Quote
  #4  
Old 07-30-2008, 03:28 AM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
ob_start();
include(
'allowip.php');
$denyadminip ob_get_contents();
ob_end_clean();
eval(
'$denyadminip = "' $denyadminip '"'); 
Reply With Quote
  #5  
Old 07-30-2008, 03:30 AM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!

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

Actually it is still executing the contents of allowip.php on all pages. So any other solutions?

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

Actually that code causes my profiles to not be able to be viewed.
Reply With Quote
  #6  
Old 07-30-2008, 08:52 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
Change the hook location if you want to change when/where a plugin is executed.
Else you need to think up some kind of condition to enclose the include.
Reply With Quote
  #7  
Old 07-31-2008, 01:58 AM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Opserty View Post
Else you need to think up some kind of condition to enclose the include.
What would be the condition to use if I wanted to use it on allowip.php?
Reply With Quote
  #8  
Old 07-31-2008, 03:14 AM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The way you have it set at global its going to execute everywhere. You could change the hook location to only where you want it to execute or You could check for certain $variables that are only defined in certain sections of the site before you execute it, such as $threadinfo when viewing threads...etc. Or you could check the THIS_SCRIPT constant against what the constant is defined as in the file you want it executed. Theres a million or more ways to accomplish it. It would be easier to help you if you gave information about where your trying to get it to execute. There is no way to just say hey if I put this variable in this template thats when you need to execute the code to fill the variable.
Reply With Quote
  #9  
Old 08-02-2008, 03:19 AM
TheInsaneManiac TheInsaneManiac is offline
 
Join Date: Feb 2008
Posts: 1,360
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am trying to execute it in a file I made. It does have a THIS_SCRIPT, so how would I set it up to use this?
Reply With Quote
  #10  
Old 08-02-2008, 04:36 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you are trying to execute that code in a custom file - why not put it into the file in the first place?
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 06:47 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.04289 seconds
  • Memory Usage 2,238KB
  • 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
  • (1)bbcode_code
  • (1)bbcode_php
  • (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
  • (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