![]() |
Include PHP in an advert
Hey I asked the following question over at vBulletin.com:
Quote:
Basically, all I need to do is place an include to one php file in an advert. I don't mind hard coding the reference into the remplate if necessary, rather than going through the ad system. Thanks |
You should be able to do something like this: create a plugin using hook location parse_templates, and code like this:
Code:
ob_start(); And then in the ad template, use {vb:raw included_file}. Of oucrse you need to use the actual path and file name, use the right template name for the ad location, and you can change 'included_html' to comething else if you want. |
Thanks for the suggestion, I've given it a go but it doesn't seem to work. Would you be able to sanity check what I've done?
1. I setup a new plugin with the following details: Product: vBulletin Location: parse_templates Name: included_html Code: Code:
ob_start(); Location: Below Navbar Ad HTML: Code:
{vb:raw included_html} What am I missing? --------------- Added [DATE]1365242536[/DATE] at [TIME]1365242536[/TIME] --------------- Ok, I can see my ad code should probably be: Code:
{vb:raw included_file} |
Quote:
Try using 'ad_navbar_below' as the template name (in place of 'navbar'). |
No worries. It's still not working though :-/
Am I asking for an extra level of complexity here, I don't mind putting the variable directly into the template, would that be easier? |
You could certainly try that. So then you *would* use 'navbar' for the template name.
If that doesn't work, try temporarily adding a line to the plugin, like this: Code:
ob_start(); and see if that shows up. |
So I switched the template to 'navbar' and added in the {vb:raw included_file} line to the template directly and that worked!
I also tried your debug code (while using the ad too), but it had no effect. I think I'll stick to putting the code directly into the template - but if you have any more suggestions why the original attempt failed I'd be interested in learning more. Thanks! |
I don't see why it didn't work - I'd have to run some tests. But if you have it working, I guess it doesn't really matter which template you had to edit. :)
|
All times are GMT. The time now is 09:11 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|