PDA

View Full Version : GAB ads in non-standard templates


inthezone
11-30-2006, 04:24 AM
For whatever reason, awhile back I decided to create my own header template that would be called from vB's default header template. While a $GAB_ads block appears when I place it in the latter, it doesn't appear if inserted into my custom template, where the bulk of the layout actually is. How can I configure this template to recognize the $GAB_ads variable?

The Geek
11-30-2006, 08:58 AM
If the layout is called out of scope (i.e. in a function) then in the function you will need to enter:

global $GAB_ads;


HTHs

inthezone
11-30-2006, 11:46 PM
Here is my default vB header template:

$myheader

<!-- content table -->
$spacer_open

$_phpinclude_output

$myheader is called through the following plugin (hook location: global_start):

eval('$myheader = "' . fetch_template('myheader') . '"; global $GAB_ads;');

Yet, when I place $GAB_ads[0] in the $myheader template, it still doesn't appear. Did I set up the plugin incorrectly?

The Geek
12-01-2006, 09:10 AM
OK... I see what you mean. In that case you dont need to put global $GAB_ads; there. You do however want to check that the GAB code in the global_start hook is executed BEFORE your code.

inthezone
12-02-2006, 12:57 AM
OK... I see what you mean. In that case you dont need to put global $GAB_ads; there. You do however want to check that the GAB code in the global_start hook is executed BEFORE your code.

I've tried placing the global declaration before $myheader, after, within the eval(), outside of it, etc., but to no avail.

The Geek
12-02-2006, 08:41 AM
Skip the global declaration, the code that starts GAB up is located in the global_start hook. You need to make sure that the GAB code is getting called BEFORE your code gets called as they are both sharing the same hook.

inthezone
12-03-2006, 03:54 AM
Skip the global declaration, the code that starts GAB up is located in the global_start hook. You need to make sure that the GAB code is getting called BEFORE your code gets called as they are both sharing the same hook.

That did the trick. Thanks!