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

How can I add code into the < head > portion of my template?

edited April 2017 in Vanilla 2.0 - 2.8

Hello everyone,

I'm trying to insert the following code into the < head > section of my template:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://crisisforums.org/jquery.touchSwipe.min.js"></script>

<style type="text/css">

#myreel{ /*sample CSS for demo*/
.paginate{
width: 300px;
margin-top:5px;
text-align:center;
}

</style>

<script src="http://crisisforums.org/reelslideshow.js" type="text/javascript">

</script>

<script type="text/javascript">

var firstreel=new reelslideshow({
    wrapperid: "myreel", //ID of blank DIV on page to house Slideshow
    dimensions: [960, 200], //width/height of gallery in pixels. Should reflect dimensions of largest image
    imagearray: [
        ["http://www.crisisforums.org/uploads/editor/4p/6v2d2zsm69pq.jpg"], //["image_path", "optional_link", "optional_target"]
        ["http://www.crisisforums.org/uploads/editor/n0/xnr3dxskzqgd.jpg", "http://en.wikipedia.org/wiki/Cave", "_new"],
        ["http://www.crisisforums.org/uploads/editor/48/zynfjpln0lpu.jpg"], //<--no trailing comma after very last image element!
    ],
    displaymode: {type:'auto', pause:5000, cycles:2000, pauseonmouseover:true},
    orientation: "h", //Valid values: "h" or "v"
    persist: true, //remember last viewed slide and recall within same session?
    slideduration: 300 //transition duration (milliseconds)
})

</script>

However, when I do so, the website konks out. I noticed that it's calling upon a resource called "head asset" - is there a separate location outside of the template where I should insert this code?

Any help is appreciated!

Comments

  • edited April 2017

    Are you trying to embed a slide show ?

    If your theme is based on a tpl template, you need to add the code in the default.master.tpl in the head area. between {literal}codehere{/literal} tags each script needs to be in a separate literal tag.

    This has been covered here a million times and found when you search "How to add js to my tpl template? " or added js to my tpl default.master.tpl and broke my site... or where can I find a tutorial ?

    Maybe look at the VSlider plugin for guidance...

  • @vrijvlinder said:
    Are you trying to embed a slide show ?

    If your theme is based on a tpl template, you need to add the code in the default.master.tpl in the head area. between {literal}codehere{/literal} tags each script needs to be in a separate literal tag.

    This has been covered here a million times and found when you search "How to add js to my tpl template? " or added js to my tpl default.master.tpl and broke my site... or where can I find a tutorial ?

    Maybe look at the VSlider plugin for guidance...

    I am, and your solution worked perfectly - thanks again very much for you help

  • @vrijvlinder said:
    Are you trying to embed a slide show ?

    If your theme is based on a tpl template, you need to add the code in the default.master.tpl in the head area. between {literal}codehere{/literal} tags each script needs to be in a separate literal tag.

    This has been covered here a million times and found when you search "How to add js to my tpl template? " or added js to my tpl default.master.tpl and broke my site... or where can I find a tutorial ?

    Maybe look at the VSlider plugin for guidance...

    Just out of curiosity - do the "CLeditor" or "Quotation" plugins / features of Vanilla depend on anything outside of their plugin files?

    I'm asking because when I inserted the above code, it worked great - but then suddenly quotations and wyziwig editing suddenly broken, and I can't figure out why it would do that.

  • @MrCanadian said:
    Just out of curiosity - do the "CLeditor" or "Quotation" plugins / features of Vanilla depend on anything outside of their plugin files?

    I'm asking because when I inserted the above code, it worked great - but then suddenly quotations and wyziwig editing suddenly broken, and I can't figure out why it would do that.

    No, I can't possibly know... sorry , people that come here for help should already know or understand basic coding concepts...

    I don't know what version you are using or what plugins ... I do know that in another discussion you started, you stated you were using an old version no longer supported...

    If this is the case then I refuse to help and others should too.

    You have been around for years and you should know what is going on by now.. and how to ask for help..

  • @vrijvlinder said:

    @MrCanadian said:
    Just out of curiosity - do the "CLeditor" or "Quotation" plugins / features of Vanilla depend on anything outside of their plugin files?

    I'm asking because when I inserted the above code, it worked great - but then suddenly quotations and wyziwig editing suddenly broken, and I can't figure out why it would do that.

    No, I can't possibly know... sorry , people that come here for help should already know or understand basic coding concepts...

    I don't know what version you are using or what plugins ... I do know that in another discussion you started, you stated you were using an old version no longer supported...

    _ If this is the case then I refuse to help and others should too._

    You have been around for years and you should know what is going on by now.. and how to ask for help..

    Fair enough, Vrijvlinder. I'll steer clear.

    Thanks for your time and previous assistance.

Sign In or Register to comment.