The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Include PHP in Template and call Function
so i get how to include a PHP file in my template using the Plug system, but then the vBulletin manual says that I need to put the contents of the file into a variable like $includedphp and when I want to output its contents, I just call $includedphp from the template.....BUT
my include file is just a bunch of functions and I want the template to be able to access the functions (like footers, headers, stuff generated from the DB) so in the template i need: <div id="footer"> <? display_footer(): ?> </div> ...i need somehting like that work. any thoughts? thanks! |
#2
|
||||
|
||||
Try $myvar = display_footer(); and put $myvar to the template.
|
#3
|
|||
|
|||
so put $myvar = display_footer(); in the hook?
Code:
ob_start(); include('path/to/file/cms.php'); $includedphp = ob_get_contents(); $myvar = display_footer(); ob_end_clean(); |
#4
|
|||
|
|||
Try:
PHP Code:
|
#5
|
||||
|
||||
If your function is echoing or something, you can use the codes below:
PHP Code:
|
#6
|
|||
|
|||
well, its not only the display_footer() function i need, but to answer your question:
Code:
function display_footer() { $footer = mysql_query("SELECT Footer_Text FROM footer_table WHERE F_ID = 1 LIMIT 1"); $footerrow = mysql_fetch_array($footer); print $footerrow['Footer_Text']; } @Opserty: that worked, but what if my include file has more than one function in it and i want to display different things in different areas of the template? say i have display_footer(), display_navigation(), display_header()....each now needs a variable to display in different parts...do i just create three separate hooks? @WhaLberg: thanks for ur help and responses...the only issue with ur method is that id have to change my functions to return values...these functions are also used on other nonvbulletin pages, so changing them affects other pages too |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|