Using the Server-Side Include Tag

You can use the server-side Include tag in your item/category templates and in the HTML pages hosted in your NetSuite file cabinet.

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.

Note that using Include tags, instead of repeating blocks of HTML code, can make the pages of your website render more quickly. For more information, see Best Practices for Website Performance.

For example, several pages in your website share the same HTML for a related items list template that you customized for your site. 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.

Important:

Web Site tags are not supported in SuiteCommerce Advanced websites.

To use the Server-Side Include tag:

  1. Create a text or HTML file for the code you call in other site pages.

  2. Upload this file to the appropriate folder in your NetSuite File Cabinet.

  3. Now, you are ready to create 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:

                       <%=include('/list.html')%> 
    
                  
  4. Place this tag in the hosted pages of your site, or in an item/category template where you want the common piece of HTML code to appear.

Note:

Currently, you cannot use Server-Side Include tags in site theme templates.

Related Topics

Creating Attribute Tags
Declare Attribute Tags for Tags Within Tags
Defining Custom Web Site Tags
Tags for Use in HTML Pages and Site Templates
Web Site Tags

General Notices