The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
PHP Include by thread name?
I'm php include coding listed below to put banners on the sides of my site.
I'm trying to figure out how I would be able to code it, that in the include it would load a different include depending on the thread name? example: A thread titled "Bobs Banner" would pull bobs-banner-include.php. I have searched and not found anything as of yet, I'm not sure if I'm using the right terminology, this is all new to me, any questions or suggestions please let me know. Coding I'm currently using Hooked to global_start Plugin with Code:
ob_start(); include('/includes/banner.php'); $includedphp = ob_get_contents(); ob_end_clean(); In the template.. Code:
<td width="100px" padding="5px">$includedphp</td> Code:
<body> <img src="/images/banners/banner.jpg" width="90" height="200"> </body> I tried Code:
ob_start(); include('/includes/$pagenumber.php'); $includedphp = ob_get_contents(); ob_end_clean(); |
#2
|
|||
|
|||
Quote:
I think that might work, but use double quotes, like Code:
ob_start(); include("/includes/$pagenumber.php"); $includedphp = ob_get_contents(); ob_end_clean(); |
#3
|
|||
|
|||
Thanks, I tried
Warning: include(/includes/24.php) [function.include]: failed to open stream: No such file or directory in [path]/global.php(404) : eval()'d code on line 242 Code:
ob_start(); include("/includes/$pagenumber.php"); $includedphp = ob_get_contents(); ob_end_clean(); Quote:
Quote:
|
#4
|
|||
|
|||
You might need ./includes instead of includes, but it depends on where you put your banner files. The other thing I mentioned is that if you put a '@' before statement it will cause errors to be ignored, so that if there's a thread without a banner, it won't cause an error (maybe that's not a problem if you are going to guarantee that every thread has a corresponding file). So, maybe this:
Code:
ob_start(); @include("./includes/$pagenumber.php"); $includedphp = ob_get_contents(); ob_end_clean(); |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|