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



  • And what if I don't want the content defined in "Stuff Displayer" to be shown on pages created by the Page Management extension?
  • Well you'll need to have a look at line 11 in default.php:
    if (in_array($Context->SelfUrl, array("extension.php", "index.php", "categories.php", "comments.php", "post.php", "search.php", "settings.php")))
    ..and remove this:

    There will be no stuff displayed on extension pages anymore, including those created by the Page Manager.
  • edited January 2007
  • You don't need the \. Everything works fine. I can't explain the single vs. double quotes. It could be the way the html formatters (bbcode, etc.) translate things. I really don't know. I'll ask some friends about this.
  • Ladies and gentlemen,
    Here comes Stuff Displayer 2.0!

    I rewrote everthing and based this new version on the Annoncement extension structure. Thanks to its author, I would never have been able to code this by myself. And thanks to jimw for his suggestions and feedback.

    Stuff Displayer 2.0 comes with a working settings panel. No default.php file editing anymore, all you need to do to happily display your stuff is to check a few boxes and type in some text areas. There are also two new items especially made to display clickable banners.

    But because I kinda suck at PHP, there are many things I wish I could improve.

    First of all, there is a limitation with line breaks. If you use them, it will crash your forum because the matching item in your conf/settings.php file will be rewritten with quotes and semi-columns at the wrong places. No big deal if you still make this error: just remove every line from $Configuration['DISPLAYER_SETUP'] to $Configuration['FOOTER_STUFF'] and everything will work fine again.

    About his problem, jimw suggested to use preg_replace to replace a line break properly in the settings files, but I've no idea how to do this. If someone have a clue...

    Something else I'd like to add is a direct access to the styling of the different content items.

    I added a text area in the settings panel to edit each item's CSS without success. I used this in the if(in_array...) statement:
    ...which obviously doesn't work. I mean, it's easy to enter stuff in the text area, but I don't know how to make it reckognized as CSS code. I know "AddStyleSheet" is meant to point to an external stylesheet, but I'd like to know if there's a way to get some data from the /conf/settings.php file. Or if there's a better method...

    I also noticed Firefox has a strange behaviour with the left banner. For some reason, it adds a link covering the whole forum's width, and textlinks in the top stuff displayer seem to be slightly higher than they sould be. Not really a problem, but it still annoys me.

    Well,feedback is welcome. Happy stuff displaying!
  • edited February 2007
    After a bit of testing, I've found the line break limitation is a real problem... In fact, Google Ads don't work anymore because without proper line breaks, parts of code become commented, and of course stop working. And with line breaks the conf/settings.php file go crazy, so...

    Could a real coder give me a hand please? It would be really nice :)

    edit: jimw just suggested something interesting, I'm gonna have a look.
  • Okay, this is almost fixed, thanks to jimw (as usual, Jim, you rock :)

    Line breaks are now inserted properly BUT for some (probably very simple) reason (I don't understand because I'm too dumb), entering some stuff with line breaks once, then saving, then re-entering some stuff with line breaks and saving again causes the same mess than before in conf/settings.php.

    Here's the kind of change I've made:
    function Render() { $text = $this->ConfigurationManager->GetSetting('HEADER_TOP_STUFF', true); if ($text && $text !== 'HEADER_TOP_STUFF'){ echo '<div id=\'HeaderTopStuffDisplayer\'>'.$newtext = trim($text,"\n").'</div>'; } }
    I'm gonna mess a bit with this, but I'm clueless about what to really do at the moment.
  • Hi, I am new to the community after a friend pointed me towards vanilla a couple of weeks ago (I have very little html or php knowledge and from that point of view customising Vanilla is brillant). I was after a simple add-in to display a header banner and this is perfect for it, however....:) I have a problem with display in IE when stuff displayer is activated the catagory and discussions list is pushed down beneath the last object in the left hand menu when stuff displayer is activated. This is only a problem in IE and does not show up in firefox. I can pm a test member account if you wish to see the issue at the site (
  • I'm not sure I understand what your problem is, so yes, a test account would probably help. From here I can see the category list is pushed to the bottom in IE6 & IE7. All categories are hidden for non-members, aren't they? Does this occur when you're logged in?

    I love Internet Explorer.
  • edited February 2007
    I've fixed a blank space bug before the discussions & categories lists in IE. It appeared when some stuff was displayed above the header. Thanks to madbeard for pointing out this. Version 2.0.2 has been uploaded.

    I'm still trying to find a solution to allow regular line breaks, which means also allowing Google Adsense. Technically speaking the Ads are working, but the setting file goes crazy and breaks the forum the next time you save something in the administrative settings (not only in Stuff Displayer but anywhere else).
  • edited February 2007
    Hi, this is one of the most useful/important extensions - thank you for your work! Lets hope you can fix the settings file "bug" and the forum is not broken after saving. Thank you!
  • edited February 2007
    Hi 0, did you try to save the HTML code a user wants to add with your extension into another file or even in the DB? Maybe this fixes our trouble with messing up the forum or even making it not showing anymore. For example the extension "Sidepanel" stores the added html code in it's own extension folder in the default.php in a $content = <<< ENDCODE my html here ENDCODE;. This even works with linebreaks and all you can think of. I have the feeling that this would fix all the problems but I am unable to code this myself... Would you please give it a try? :-)
  • edited February 2007
    I already tried this for the the first version, which had no administrative settings, and failed miserably. My PHP skills increased a bit but I'm still a sunday afternoon coder...

    At the moment I'm struggling with preg_replace and trim, trying to understand where to put this in the code to replace line breaks before the settings file is saved, and I barely understand what I'm trying to do :/

    But yeah, it's a good idea, it could be interesting to look again at this ENCODE stuff - or even use a different file from the settings file to store content. At least it would break the extension but not the entire forum.
  • Maybe it is worth a try. I am sure it will work just fine if you save the html in another file. But I am no help in the coding itself :-) Sorry.
  • After a bit of testing I've found the problem and I pretty know what it is, but I don't know how to solve it.

    When someting is saved in the settings.php file, it replaces the previous specified setting. But it only replaces the FIRST line. So everything is fine until you save something which takes several lines. The first time you save some multi-lines content, it's stored without a problem, but the second time, whatever you save, it breaks.

    Let's say you type this then save:
    Line 1 Line 2 Line 3
    You get this in conf/settings.php:
    $Configuration['YOUR_SETTING'] = 'Line 1 Line 2 Line 3';
    It's fine. But save again, and you get this:
    $Configuration['YOUR_SETTING'] = 'Line 1 Line 2 Line 3'; Line 2 Line 3';
    Which of course produces this:
    Parse error: parse error, unexpected T_STRING in \conf\settings.php on line xxx, does somebody know a way to replace not only the first line but all lines when saving? What should I add before saving in order to avoid this?
  • To be honest that's a flaw in the application I think? Shouldnt vanilla replace up to the next semicolon, Mark? That's how PHP will read it anyway..?
  • I think you could add a call to str_replace function to change the linefeed and carriage returns in the string to the br tag.
    $str = "your data"; $order = array("\r\n", "\n", "\r"); $replace = "<br />"; $new_str = str_replace($order, $replace, $str);
  • edited February 2007
    Yep, I tried this, but honestly I don't know where to put it. I think I've found where in the code the settings file is saved, but I don't know how to implement this.

    Another problem is I'm not sure it will allow to make Google Ads work properly since their code's first line includes this :
    So it should comment a br tag inserted at the end...
  • edited March 2007
    Hi again.
    I have tried to put the following google adsense code below the forum's header:

    <script type="text/javascript"><!-- google_ad_client = "pub-4961308003055485"; google_ad_width = 728; google_ad_height = 15; google_ad_format = "728x15_0ads_al_s"; //2007-03-01: google_ad_channel = "0478487739"; google_color_border = "ffffff"; google_color_bg = "ffffff"; google_color_link = "E10000"; google_color_text = "000000"; google_color_url = "335EB7"; //--></script> <script type="text/javascript" src=""> </script>

    This does not work because it is putted into the page like this:

    <script type="text/javascript"><!-- google_ad_client = "pub-4961308003055485"; google_ad_width = 728; google_ad_height = 15; google_ad_format = "728x15_0ads_al_s"; //2007-03-01: google_ad_channel = "0478487739"; google_color_border = "ffffff"; google_color_bg = "ffffff"; google_color_link = "E10000"; google_color_text = "000000"; google_color_url = "335EB7"; //--></script> <script type="text/javascript" src="">

    As I have suggested, maybe it would work if you put the html code that one wants to be included in an external file or in the default.php? I think that would solve all the issues...

    Thank you for your great extension :-)
  • Any other PHP programmer out there with an idea?
This discussion has been closed.