Hey Rick,
Is there any documentation on
<%= RenderSection("scripts") %>
I've looked in the help file but can't seem to find it.
I'm wanting to use Charge.js to generate some charts for a dashboard page and was thinking I could build the scripts on the fly and then have them rendered with the page.
Putting them in the scripts section at the bottom of the page seems like it would be the best place to do so.
I saw the RenderSection utility but am not sure how it works.
Any help would be appreciated.
Thanks!
-Phil
Here's the relevant topic:
Thanks for the quick reply.
Still not clear on what it's doing when it hits the
<%= RenderSection("scripts") %>
Is it looking for
No.
It's looking for a section called scripts
. The section exists in the layout page and you're referencing the section in that page. IOW, you're basically saying:
- Embed the following content in the
scripts
section of the Layout page
The idea for this is that if you have a Content page (ie. CustomerList.wwd
for example) and you need to embed some custom javascript, that script has to be loaded after all the other scripts have loaded. Since by default scripts load at the bottom of the Layout page which is the parent page container, a Content page could by itself never get the script loaded after the base scripts since those are defined at the bottom of the layout page.
Sections allow you to specify areas in the Layout page that a content page can inject content into.
The scripts section allows you to force the scripts into the correct location in the layout page so your page specific scripts can render at the bottom of the rendered HTML page after the base scripts.
Note you can create additional sections in the layout page where you want to embed content. By default there are two sections:
- headers (renders at the bottom of the
<head>
section) - scripts (renders after the stock script definitions on the bottom of the page)
+++ Rick ---
You might want to take another look at the docs too, which have been updated with a bit more info:
+++ Rick ---