Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Stuff Displayer 2.0

Hi folks.

Today I was struggling to put Google Ads at the bottom of my forum. The side panel extension is great for custom content in the side panel (of course...) but what if you want to add stuff somewhere else?

Well, you grab some pieces of code from the Random Quote extension, try to figure out how it works, and finally come with Stuff Displayer 1.0.

This is quite primitive, but it allows you to put custom content above or below your forum's header, or in the footer. Originally I just wanted a better control over my Google ads in the footer (and avoiding to hack foot.php). But you can use it to add anything: banners, links, text, whatever you need. Since I'm not really a coder I've no idea if I've built this in a correct way, but using my shameless cut-n-paste technique, I finally made it work.

Thanks (again) to jimw: I used most of the code he wrote for the Random Quote extension.


  • This is nice. Real nice.
  • Glad you like it :)

    Now I'm thinking about a way to show three different contents with a single extension. Currently you can only display the same item in the different positions, but it shouldn't be too hard to manage three distincts items, one for each position.
  • Okay, it was easier than I thought. Now you can display up to three different items at the same time.
  • I like the sound of this. Could it be extended to include other areas? eg the account page?
  • Well, it displays your custom content on all of your pages, including the account page. It's funny you're talking about this, because I noticed there is a problem on this page with the footer content. I don't know why, but Vanilla seems to think the footer starts beside the account information, not under it. Dunno what you want to put on the account page, but with this "problem" you can currently add stuff where the role history is usually displayed, for example.

    If you want to display your stuff on some particular pages only, edit default.php and remove what you don't need in the array at line 13:
    array("index.php", "account.php", "categories.php", "comments.php", "post.php", "search.php", "settings.php")
    I'm not skilled enough in PHP to allow people selecting a different content for each page, but you can do this manually quite easily. Make several copies of the extension, name them differently then create your own classes. For example, just replace each HeaderTopDisplayer by something else. With this method, if you make a copy for each page, you can display a unique item for each position and each page.
  • thanks for this! i was going crazy trying to put my googleads at the bottom of the page and this made it easy. props!
  • I can't seem to add any of our ad engine options. It just breaks the forum. Here are the code options I have to serve ads: Local URL ads <?php if (@include('/home/---/---/')) { if (!isset($phpAds_context)) $phpAds_context = array(); $phpAds_raw = view_raw ('zone:63', 0, '_blank', '', '0', $phpAds_context); echo $phpAds_raw['html']; } ?> Or <script language='JavaScript' type='text/javascript' src=''></script> <script language='JavaScript' type='text/javascript'> <!-- if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write ("<" + "script language='JavaScript' type='text/javascript' src='"); document.write ("" + phpAds_random); document.write ("&what=zone:63&target=_blank"); document.write ("&exclude=" + document.phpAds_used); if (document.referrer) document.write ("&referer=" + escape(document.referrer)); document.write ("'><" + "/script>"); //--> </script><noscript><a href='' target='_blank'><img src='' border='0' alt=''></a></noscript> Or I can create an iframe. But non of the options seem to work. Why would these options break the code?
  • I suppose including PHP in an echo "something" may cause havoc in the extension. However, Google Adsense use javascript, and your second solution too, so I don't see why it doesn't work (but I'm definitely no javascript expert...)

    Do you get an error message? You say it breaks the forum, but what happens exactly?

    I guess I should have a look at the side panel extension to see if I can use the same method, it would be probably better to include something else than HTML.
  • edited November 2006
    Here is the error I get from the Java version. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/ on line 40 I also tried the google code and that worked fine and it's just a java script. But I noticed they don't use the single ' in the code. So I tried removing them from our Ad Servers code, but it didn't work. I don't know java at all, so I am just hacking at it.
  • Just saying... go on!
  • Okay, it's a single/double quotation mark problem.

    Using echo '...your content...' works fine for HTML because HTML doesn't use single quotes, so there's no conflict caused by a piece of code which would be understood the wrong way. I've a hard time explaining why it doesn't work in english lol but I see very well why.

    But with javascript or PHP, it's different. Problem is if there's another single quote contained within the echo '...your content...', it causes an error, because the echo function is ended too early by an unexpected quote.

    So I need to find a less primitive method than just echoing the content in order to allow the use of various quotes.
  • edited November 2006
  • edited November 2006
    Haha, I totally digg that name "Stuff displayer" :P
  • Hehe, it was originally supposed to be be called "Footer Ads Displayer", then it occured you could use it not only for ads and not only in the footer, so... :)
  • so whats up is there a fix in the works for displaying javascript in stuff displayer?
  • Thank you for finding the problems, any idea if you can change the code to allow the single or double echo? "But with javascript or PHP, it's different. Problem is if there's another single quote contained within the echo '...your content...', it causes an error, because the echo function is ended too early by an unexpected quote."
  • Either escape the single quote or use a double quote, works for me.
  • edited December 2006
    Yep, you can replace the single quotes at the beginning and at the end of the echo by double quotes, this will allow the use of single quotes inside your content. However, you still won't be able to use both single and double quotes for a same item.

    I've put single quotes here to allow the use of HTML, but yes, you can replace them by double quotes - if you don't use HTML.

    I've tried to mess a bit with the side panel extension's code, but I didn't manage to include it in mine without getting errors beyond my understanding.
  • How can I get this to work with the Members Page extension? The Stuff Displayer doesn't show up on that page.
  • Okay, I've uploaded a new version which should work. Just needed to add "extension.php" in the "if (in_array" statement.
This discussion has been closed.