This project is read-only.

Add inline script to a view

Topics: Customizing Orchard, Writing themes
Mar 23, 2013 at 6:58 AM
I've been playing with my ResourceManifest and Script.Require and Script.Include and have read through quite a few discussion posts... but I can't seem to find a way to insert a script tag inline.

This is required to use a 3rd party affiliate plugin that needs to be inserted at the exact place where the functionality is used.. i.e. a link to move the user on to the vendor site.

So, how can script be included at a specific place in the HTML?
Mar 23, 2013 at 7:30 AM
You mean, like a script tag? Did you try using a script tag in order to inject a script tag? ;)
Mar 26, 2013 at 8:31 AM
Ok, a little more info then...

I have a script in the script folder of my module.. I'll need to set the exact path then, to <script src="/modules/my-module/scripts/3rd-party.js" data-blah="63464"></script>. I can't use @Script.Include in this situation.. they must be added either head or foot?

(incidentally I've updated the plugin code so I can put it in the head and initialize it on doc ready...)
Mar 27, 2013 at 8:30 AM
And I'll repeat my question: why don't you use a script tag? Script.Include is designed to manage scripts, avoid duplicates, etc. If you need the script to be inserted in place without those concerns, there is no reason not to use a plain script tag.