Hi. I am doing a MVC template. I want to include a javascript file, enhanced.js from the "Scripts" directory in the Settings section.
If it was a Parital View that I wanted to include I would write something like @{ Html.RenderPartial("umbLatestNewsWidget"); }. Does anyone know how to include this enhanced.js file in the template?
Thank you for your answer and your welcome. I am sorry but I am not sure what you mean. Could you please give me a short code example of how to refer to a file in the directory of "Script" in Razor! I am not even sure what tbe "best practice" is. To make a macro or to refer to the file in the Script directory.
Argh, the damn editor did not accept my code from the previous post. Sorry about that. It should read
<script src="/scripts/enhanced.js"></script>
In regards to the best practice it depends on the site you're building. If you have two sites in the same solutions based on the same document types and templates but with individual functionality then it would be a good idea to use a macro to load stuff like css/scripts so the proper stuff gets loaded accordingly.
With a small correction using "Scripts" istead of "scripts" meaning that the final code will be: <script src="/Scripts/enhanced.js"></script> it works perfectly fine by now. Thank you very much, Jan, and have a nice day :-)
MVC template get a file from "script"
Hi. I am doing a MVC template. I want to include a javascript file, enhanced.js from the "Scripts" directory in the Settings section.
If it was a Parital View that I wanted to include I would write something like @{ Html.RenderPartial("umbLatestNewsWidget"); }. Does anyone know how to include this enhanced.js file in the template?
Hi Lars and welcome to our :)
You should just reference it in your template before like
Hope this helps?
/Jan
Hi Jan
Thank you for your answer and your welcome. I am sorry but I am not sure what you mean. Could you please give me a short code example of how to refer to a file in the directory of "Script" in Razor! I am not even sure what tbe "best practice" is. To make a macro or to refer to the file in the Script directory.
Thank you in advance
// Lars
Hi Lars
Argh, the damn editor did not accept my code from the previous post. Sorry about that. It should read
In regards to the best practice it depends on the site you're building. If you have two sites in the same solutions based on the same document types and templates but with individual functionality then it would be a good idea to use a macro to load stuff like css/scripts so the proper stuff gets loaded accordingly.
I hope this helps.
/Jan
Hi Jan
With a small correction using "Scripts" istead of "scripts" meaning that the final code will be: <script src="/Scripts/enhanced.js"></script> it works perfectly fine by now. Thank you very much, Jan, and have a nice day :-)
// Lars
Hi Lars
Ah yes well of course! :)
Happy you managed to solve it though - Remember to mark the post as solved as well.
A nice day to you as well.
/Jan
Hi Jan. Where do I mark the subject as "solved"?
// Lars
Hi Lars
There is a "mark as solution" option in the toolbar where you can edit a post.
/Jan
is working on a reply...