2011-07-08, 03:28 PM
Hello everyone. So I am working on my second plugin, yet its pretty simple. I have a section of code that will be put right after the header and only show for certain usergroups.
I am simply using it for adsense. The issue is, is that the variable that i set as a global isn't displaying in my template...
PHP Plugin Code:
Template Code:
What am I doing wrong? Oh and I have tested, and it is retrieving the code from setting "goog_adsense_code" correctly as I printed it to the page.
Thank You.
I am simply using it for adsense. The issue is, is that the variable that i set as a global isn't displaying in my template...
PHP Plugin Code:
function generate_adsense()
{
global $db, $mybb, $gac;
$groups = explode(",",$mybb->settings["goog_adsense_disp_group"]);
if(in_array($mybb->user["usergroup"],$groups))
{
$gac = $mybb->settings["goog_adsense_code"];
}
}
Template Code:
<html>
<head>
<title>{$mybb->settings['bbname']} - Community</title>
{$headerinclude}
<script type="text/javascript">
<!--
lang.no_new_posts = "{$lang->no_new_posts}";
lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body id="home">
{$header}
{$gac}
{$itph}
{$topic_header}{$forums}
{$itpf}
{$boardstats}
<br style="clear: both" />
{$footer}
</body>
</html>
What am I doing wrong? Oh and I have tested, and it is retrieving the code from setting "goog_adsense_code" correctly as I printed it to the page.
Thank You.