I'm thinking it's just a PHP code error, but for some reason the following code won't work, it just keeps giving me Internal Server Error 500
<?php
$ajfl_adLuck = rand(1,3);
if ($ajfl_adLuck == 2) {
echo "<div id=\"sidebar-awesome-container\">";
echo "<div id=\"sidebar-awesome-wrapper\">";
echo "<img src=\"" . bloginfo('template_url'); . "/img/sample-ad-side.png\" alt=\"Sample Advertisement\">";
echo "</div>";
echo "</div>";
} else {
echo "";
}
?>
Basically, my site is slightly different in that the sidebar is inside the WordPress Loop, because rather than a list of categories and metadata stuff it displays the post's information. I want an ad displayed down the sidebar, but not on every post, only on, let's say, a third of them.
I was wondering why my current code won't work. Quite new to PHP so I'm guessing it's a syntax error, but I've been working on it fot over an hour and still can't find the fix.
Any help is appreciated, whether it's a fix or a better way to do this.
Thanks.