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.
Options

Adding JS to all pages

edited September 2006 in Vanilla 1.0 Help
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?

Comments

  • Options
    I think it's a little more complicated than that. I checked the wordpress plugin to see what it does. It looks like it has some admin involved.
  • Options
    Maybe broadening the questions will get more help... How do I _easily_ add one line of js to my pages? Is there a plugin, or just somewhere I can add it to the php to get it to do that? Note: I am quite limited in my php capabilities (although I am learning a wee bit)...
  • Options
    if you want the javascript to load at the end 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'))) { 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.
  • Options
    Bee-u-tee-full! Thanks... I'll have a go at it soon.
This discussion has been closed.