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.
Adding JS to all pages
How would I go about adding Mint to my Forum? I just need to add one line of js to every page. And while I'm at it, a link back to my homepage would be nice on each page. Is that what the sidebar extention is used for?
0
This discussion has been closed.
Comments
<?php /* Extension Name: Your extension Extension Url: http://whatever Description: Blah blah Version: 0.1 Author: wafflestomper Author Url: http://whatever */ if ( !in_array($Context->SelfUrl, array('settings.php'))) { class AddYourJavascript extends Control { function Render() { echo ' <script type="text/javascript"> // your javascript goes right here; </script> '; } } $AddYourJavascript = $Context->ObjectFactory->NewContextObject($Context, "AddYourJavascript"); $Page->AddControl("Page_Render", $AddYourJavascript, $Configuration["CONTROL_POSITION_FOOT"]); } ?>
if you want it inside the head so it loads before the rest of the page:
<?php /* Extension Name: Your extension Extension Url: http://whatever Description: Blah blah Version: 0.1 Author: wafflestomper Author Url: http://whatever */ if (!in_array($Context->SelfUrl, array('settings.php')) && isset($Head)) { $Head->AddString(' <script type="text/javascript"> // your javascript goes right here; </script> '); } ?>
either way, copy the one you want and save it as extensions/YourExtension/default.php
(change YourExtension and the code to match your needs of course)
there are other ways to accomplish this, but these will work.