Perceptive Enterprise Search new template engine includes the integration of a scripting engine that enables advanced customization of templates and web pages. Any file that Perceptive Enterprise Search serves that has a content type of text/html will automatically be passed through the template engine.
The Perceptive Enterprise Search scripting languages mirror the techniques and objects exposed in ASP. The default language is VBScript, however you may choose a language that supports Microsoft Windows Scripting.
When Perceptive Enterprise Search is processing a web page or template, it looks for special tokens that indicate where script begins and ends. The tokens are <%...%>, anything contained within these two symbols is script. The example below shows a web page, the script is marked in bold.
<html> <head> <title>Sample Page</title> </head> <body> <b> <% ' Build a string with todays time strTime = "The time on the server is " & Time Response.Write strTime %> </b> </body> </html>
When Perceptive Enterprise Search processes this page, it will process the script and send the results to the user. The previous sample would result in the following being sent to the user:
<html> <head> <title>Sample Page</title> </head> <body> <b> The time on the server is 12:23:22 </b> </body> </html>
The Response.Write is one method of injecting code into the HTML stream that is sent to the user, an alternative method is to use the <%=...%>. Note the equal sign (=). Here is the code from above modified to use <%=...%>.
<html> <head> <title>Sample Page</title> </head> <body> The time on the server is <b><%= Time %></b> </body> </html>
The <%=...%> symbols imply a Response.Write, it will insert whatever is between the <%= and %> symbols. If the content is a variable, the variable's value is inserted into the HTML stream.