Fix former "Panelhider" extension to work with new vanilla versions?
Don't know if this has been asked before, but couldn't find anything 'bout it when searching the forum. If I remember correctly, earlier versions of vanilla offered a possibility to hide/unhide the panel on the left side by clicking on a button. What happend to this?
0
This discussion has been closed.
Comments
I can't imagine it was terribly complicated though.
Add a toggle-switch button to your theme, or via an add-on where you want to have it, and use it to switch the status of #Panel between visible and hidden. There's probably the JS function in prototype (bundled) for that already.
You'll also need to adjust css for #Content as follows, either in the vanilla.css of your theme or via the add-on:
#Content { margin:0px 18px 0px 18px; }
inside /extensions on our Vanilla 1.0.3.
As far as I can see it, the extension consists of these files:
- btn.hidepanel.gif
- btn.revealpanel.gif
- PanelHider.php
- panelhider.handheld.css
- panelhider.hidden.css
- panelhider.js
- panelhider.visible.css
I renamed 'Panelhider.php' to 'default.php' and put all files inside /extensions/Panelhider. Afterwards I tried to activate the extension to see what happens. And guess what? I got an error.if ($Context->Session->User->Setting("HidePanel")) {
This is the complete code of Panelhider.php (I removed the comments, so that the code didn't get too long)
<?php if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php", "settings.php")) && $Context->Session->UserID > 0) { class PanelHider extends Control { function PanelHider(&$Context) { $this->Context = &$Context; } function Render() { $this->Context->Writer->Write("<div id=\"HiddenPanel\"><a href=\"javascript:RevealPanel();\"> </a></div> <div id=\"HidePanel\"><a href=\"javascript:HidePanel();\"> </a></div>"); } } if (@$Head) { $Head->AddScript($Context->StyleUrl."panelhider.js"); if ($Context->Session->User->Setting("HidePanel")) { $Head->AddStyleSheet($Context->StyleUrl."panelhider.hidden.css", "screen"); } else { $Head->AddStyleSheet($Context->StyleUrl."panelhider.visible.css", "screen"); } $Head->AddStyleSheet($Context->StyleUrl."panelhider.handheld.css", "handheld"); $PanelHider = $Context->ObjectFactory->NewContextObject($Context, "PanelHider"); $Page->AddControl("Panel_Render", $PanelHider); } } ?>
Anyone here who can fix it to work in newer vanilla versions?
<style type="text/css"> Body {background-image: none;} #Panel {display:none;} #Content {margin:0px 18px;} </style>
Note: briefly tested, but it seems to work fine in Opera 9.10, FF 2.0.0.2 and IE 7.0.57)
Tried the following on themes in FF2 (with positive results):
vanilla default, black and white, europeaftertherain, vaneablack, YHbeta, Scene 1.0