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
This discussion has been closed.
Comments
if (in_array($Context->SelfUrl, array("extension.php", "index.php", "categories.php", "comments.php", "post.php", "search.php", "settings.php")))
..and remove this:
"extension.php",
There will be no stuff displayed on extension pages anymore, including those created by the Page Manager.
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:
$Head->AddStyleSheet($Context->GetDefinition('HeaderTopStyle'));
...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!
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.
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.
I love Internet Explorer.
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).
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.
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
...so, 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?
$str = "your data"; $order = array("\r\n", "\n", "\r"); $replace = "<br />"; $new_str = str_replace($order, $replace, $str);
Another problem is I'm not sure it will allow to make Google Ads work properly since their code's first line includes this :
<!--</b>
So it should comment a br tag inserted at the end...
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: investorsbull.com 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="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </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: investorsbull.com 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="http://pagead2.googlesyndication.com/pagead/show_ads.js">
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 :-)