HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Add custom .css and .js files to a default.master.php

edited August 2011 in Vanilla 2.0 - 2.8
Hi all,

I have created a forum design and have it in custom HTML format.

I want to use Vanilla as the brains behind the design. I have currently:

- Setup a copy of the 'default' folder, renamed it and have it selected as my current theme.
- Copied 'default.master.php' to my themes 'views' folder.


I now have a few questions to get me going if somebody could help:

- What is the best way to add 'reset.css' file, 'custom.css' and 'ie.css' files to the master header.
- I also want to add some custom .js files to my header. Is adding them to the root 'js' folder a bad idea (incase they are overwritten in future updates)?
- Can I use SMARTY code within Vanilla? I was under the impression I could but the default.master.php is a .php file not a SMARTY .tpl?


If anybody can help me out I would appreciate it, any other tips before I start would be great too.

thanks.

Answers

  • Never mind, I managed to write a custom hook file and use the AddCss & AddScript functions.

    I am now using SMARTY too as i copied the BrandFriendly theme.
  • LincLinc Former Staff Detroit Admin
    Nice!
  • @danlaw86 could you write short explanation on how you did the themehook+addscript ?
  • @nepwk I will try my best.

    Basically I created a file in my theme folder called 'class.*********themehooks.php' - Replace ********** with your theme name.


    Here is the contents of the file:
    http://pastebin.com/eLNJt6Pi

    Replace MyThemeName with your theme name.

    Hope that helps.

  • i want to enter adsense script at the end of the first discussion

    Ex. Here it is started with Hi all, and ended with thanks. I want to enter the adsense after thanks, or before thanks. I tried the method you said, I used
    class DefaultThemeHooks extends Gdn_Plugin {

    But script tag is stripped.
Sign In or Register to comment.