Tag to use for repeating blocks of HTML code

We can use the server-side Include tag in your item/category templates instead of repeating blocks of HTML code.

The server-side Include tag is useful for reusing a common piece of HTML code throughout your site, such as a page header, a page footer or a navigation menu. When it is time to update that piece of code, you do not need to update the code on each template and HTML file in your account. You only need to update the file referred to in the Include tag.

Upload a text or HTML file that includes the code in the appropriate hosted file folder in your NetSuite file cabinet. Next, use the Server-Side Include tag in the item drilldown template to call HTML code in the hosted file. When you need to make changes to the HTML for your related items list, you can edit the hosted file.

To use the Server-Side Include tag:

1)Create a text or HTML file for the code you call in other site pages.Upload this file to the appropriate folder in your NetSuite File Cabinet.

2)Add your Server-Side Include tag. This is the syntax:

<%=include(‘URL’)%>

Replace URL with the site-relative URL of your HTML or text file. This must be a quoted string. This field is case sensitive. For example:

eg:<%=include(‘/list.html’)%>

3)Place this tag in an item/category template where you want the common piece of HTML code to appear.

Note: you cannot use Server-Side Include tags in site theme templates.

Leave a comment

Your email address will not be published. Required fields are marked *