Web Connection
<%= RenderSection("scripts") %>
Gravatar is a globally recognized avatar based on your email address. <%= RenderSection("scripts") %>
  Phil Sherwood
  All
  Aug 13, 2017 @ 11:22am

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

Gravatar is a globally recognized avatar based on your email address. re: <%= RenderSection("scripts") %>
  Phil Sherwood
  Rick Strahl
  Aug 13, 2017 @ 12:43pm

Thanks for the quick reply.

Still not clear on what it's doing when it hits the

<%= RenderSection("scripts") %>

Is it looking for

Gravatar is a globally recognized avatar based on your email address. re: <%= RenderSection("scripts") %>
  Rick Strahl
  Phil Sherwood
  Aug 13, 2017 @ 03:11pm

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 ---

Gravatar is a globally recognized avatar based on your email address. re: <%= RenderSection("scripts") %>
  Phil Sherwood
  Rick Strahl
  Aug 13, 2017 @ 03:35pm

Excellent explanation. Copy that into the help file. -grin

Thanks for your help!

-Phil

© 1996-2024