Behnam Esmaili
Behnam Esmaili

Reputation: 5967

How to include resources of a module in alternative views in Orchard?

suppose there is a module which has a view and this view included a java script file in it:

like this :

Script.Include("myscripts/somescript.js");

so when i create an alternative view from the original one, it will placed inside MyTheme folder(some where other than module's directory) that obviously cannot access script folder of original view.
the question is : now how to access that resource folder from within alternative view?

thanks in advance.

Upvotes: 3

Views: 436

Answers (1)

Brandon Joyce
Brandon Joyce

Reputation: 3110

Sounds like you should use a ResourceManifest to register the script. Check out how the Orchard.JQuery module registers all the different jQuery files. Once you have that, and the module is enabled, you can require a script with its registered name...

Script.Require("somescript");

Upvotes: 2

Related Questions