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

Reply
 
Thread Tools Display Modes
  #11  
Old 09-13-2002, 10:22 PM
futureal futureal is offline
 
Join Date: Feb 2002
Location: Del Mar, CA, USA
Posts: 556
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You could put something like $stuff = something; in global.php and then use $stuff in a template anywhere on the site.
Reply With Quote
  #12  
Old 09-13-2002, 10:26 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by futureal
You could put something like $stuff = something; in global.php and then use $stuff in a template anywhere on the site.
Is that the actual code?

so if I put
PHP Code:
$shortnews = include("shortnews.php"); 
then in my templates whenever I put in $shortnews it would call the shortnews.php file?

I just wanted to make sure that was the exact code or if you were putting more emphasis on "like"?

This is going to be KICK ASS!
Reply With Quote
  #13  
Old 09-14-2002, 02:19 AM
futureal futureal is offline
 
Join Date: Feb 2002
Location: Del Mar, CA, USA
Posts: 556
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sort of, but not exactly.

In your global.php file, you need to add a line like this:

PHP Code:
$something = eval("include(\"somefile.php\");"); 
The eval() function evaluates a line of code "on-demand" rather than every time the script runs. In other words, if you did it your way (without eval) then it would just display the contents of the included PHP file at the top of every page -- I don't believe include() returns a value.

Anyway, then in your templates, wherever you add $something, you will get the contents of the PHP file.

This is essentially the third option that Logician gave:

Quote:
3- Add you code to global.php. It also runs everytime any vb scripts runs, just like phpinclude template.Therefore you can try to add either the include statement or the entire code to global.php as well..
And yes, it works; I just tested it on one of my sites. Have fun.
Reply With Quote
  #14  
Old 09-14-2002, 07:39 AM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That seems to do the same thing. I didn't even call it in the template. As soon as I put it in the global file it called it and put it above the header.

Anything else?
Reply With Quote
  #15  
Old 09-14-2002, 04:29 PM
futureal futureal is offline
 
Join Date: Feb 2002
Location: Del Mar, CA, USA
Posts: 556
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, for some reason I was thinking that your included file would be performing some sort of function rather than just outputting data.

I thought about it some more, and I'm not sure how you would get the output "on demand" as you suggest, without adding it to the vBulletin code -- assuming that the PHP file you want to include echoes something back.

Why not just edit the files so that they "store" their output in a variable, then put the file in the global.php as I suggested (or the phpinclude template as Logician suggested) and then just use that variable where you need the output?

I can't think of any other way to do it. I think that to achieve what you're trying to do, you're going to need to work with the code one way or another.
Reply With Quote
  #16  
Old 09-14-2002, 04:35 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by futureal
OK, for some reason I was thinking that your included file would be performing some sort of function rather than just outputting data.

I thought about it some more, and I'm not sure how you would get the output "on demand" as you suggest, without adding it to the vBulletin code -- assuming that the PHP file you want to include echoes something back.

Why not just edit the files so that they "store" their output in a variable, then put the file in the global.php as I suggested (or the phpinclude template as Logician suggested) and then just use that variable where you need the output?

I can't think of any other way to do it. I think that to achieve what you're trying to do, you're going to need to work with the code one way or another.
Can one of you help me with doing that? I'm a noob when it comes to rewriting the code, etc. Can anybody give me instructions on what I need to do inorder to get this to work? :ermm:
Reply With Quote
  #17  
Old 01-25-2003, 06:42 PM
Gutspiller's Avatar
Gutspiller Gutspiller is offline
 
Join Date: Dec 2001
Posts: 1,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump!
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 01:58 AM.


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.05552 seconds
  • Memory Usage 2,229KB
  • 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
  • (2)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
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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