Where to put Script.Require to load columnizer.js on all pages

Topics: General
Sep 12, 2011 at 5:15 PM

I need to add the columnizer.js to my Orchard site in a way that it load on all pages.  I've placed the js file in the ~\Modules\Orchard.jQuery\Scripts\ folder and added


to the ResourceManifest.cs file in the ~\Modules\Orchard.jQuery\ folder.  But now I'm not sure where to put Script.Require("columnizer").AtHead();


thnx,  -a

Sep 12, 2011 at 5:59 PM

I would add it to the layout.cshtml file within your theme...

but.. I would actually do this instead of your solution.

Open your Layout.cshtml file within your theme and add... Script.Include("path to \columnizer.js")

if it is dependent of Jquery... then add Script.Require("jQuery") in there as well.


Sep 12, 2011 at 6:08 PM

Hey thanks Nick! I figured that out just before I read your post.  I've been fighting with the Script.Require("jQuery") until I realized ...sllloooowwwwlllly reading your response I had Script.Include("jQuery");

Again, thnx!



Sep 12, 2011 at 6:20 PM

I would not actually alter the jQuery resource file. Just add Script.Require("columnizer.js"), and the script inside your theme's script folder.

Sep 13, 2011 at 7:01 PM

I don't typically design/develop in a Microsoft environment, and thus far I find Orchard to be rather arcane. So I need help.

What I'm not clear on is exactly where the Script.Require("myScript.js") command should go. The layout.cshtml file for my custom theme? Elsewhere?

Thanks to anyone who can patiently set me straight...


Sep 13, 2011 at 7:17 PM

Wherever you need it.

Sep 13, 2011 at 7:29 PM

if you put it on Layout.cshtml it will show on every page, or you can put it in which ever views you so require. :)