Inserting PHP into the footer
#1
Hey,

I'm using an advertisement rotation script in my footer but nothing is showing up. The script is

<?php

$fcontents = join ('', file ('banner_ads.txt'));
$s_con = split("~",$fcontents);

$banner_no = rand(0,(count($s_con)-1));
echo $s_con[$banner_no];
?>

Please help!
Electro Jams - Electronic jam bands, electronica, IDM, techno, dubstep, you name it
Dreadlock Forums - A site for people with dreadlocks
#2
You can't use the codes this way in MyBB.

However to make things easy for you, i recommend using Easy Adv. Banner 2.0 for fresh banner with each page load.

regards
#3
You can't do it like that, you would have todo it like this. add to your global.php script.
$fcontents = join ('', file ('banner_ads.txt'));
$s_con = split("~",$fcontents);

$banner_no = rand(0,(count($s_con)-1));
$banner = $s_con[$banner_no];
And then add $banner to your template.
#4
CraKteR Wrote:You can't do it like that, you would have todo it like this. add to your global.php script, or in the file you want it to display in.

And then add $banner to your template.

In global.php, make sure you put the code before:
eval("\$footer = \"".$templates->get("footer")."\";");
Dennis Tsang
Former MyBB Team Member
Web: http://dennistt.net
#5
Why can't I just enter the PHP in the template?

Also, where do I put it in global.php? This is all so confusing, I hardly know any PHP whatsoever...

[Edit] Nevermind, I got it working...
Electro Jams - Electronic jam bands, electronica, IDM, techno, dubstep, you name it
Dreadlock Forums - A site for people with dreadlocks
#6
You can't enter PHP into the templates because they are hard-coded HTML with the addition of MyBB variables.

All PHP must beentered into the files.
@ryanashbrook
Do NOT PM me for Support!


Forum Jump:


Users browsing this thread: 1 Guest(s)