Help > Web Development > Customizing Websites > Custom Symbol Library

Custom Symbol Library

Perceptive Enterprise Search symbol library makes is easy to build your search site using simple symbols that are substituted for their content on the fly. Some of the symbols are quite simple, returning basic text such as Custom Symbol Library or {FILENAME}.

Other symbols such as {CATEGORIES ...} and {RELEVANCEBAR ...} are more advanced returning large blocks of dynamic HTML. By using these symbols, your Perceptive Enterprise Search templates can be a lot easier to manage and read as all it contains is the {CATEGORIES} symbol, not a large amount of script to handle the categories processing.

Perceptive Enterprise Search now allows you to create your own Custom Symbols Library. This allows you to abstract your code and simplify your templates. This also promoting code reuse, as your symbols will be available to any Perceptive Enterprise Search website on your server.

Creating a Custom Symbol Library

Custom Symbol Libraries are XML files that contain the script that is to be called for each symbol. Symbol Libraries must be installed into:

Program Files\Perceptive Enterprise Search\WebComponents

The file must have an extension of .components.

Custom Symbol Library Format

<?xml version="1.0"?>
<controls>
  <control name="HelloWorld">
    <properties>
      <property name="width" type="numeric" default="140" />
      <property name="height" type="numeric" default="140" />
      <property name="caption" default="Hello World!" />
      ...
    </properties>
    <source>
      <![CDATA[
      <div style="width: <%= Property("width") %>; height: <%= Property("height") %>">
        <%= Property("caption") %>
      </div>  
      ]]>
    </source>
  </control>
  ...
  <shared>
    <![CDATA[
    ]]>
  </shared>     
</controls>

The Symbol Library can contain one or more custom symbols. Each symbol is contained within its own <control> tag. A control must have a unique name across all custom symbols, so you may want to prefix your controls with a namespace to ensure you do not get collisions.

<properties>

You can also implement optional properties that you can then access from the source of the control. Each property must be contained within a <property> tag under the <properties> tag. The property tag has the following attributes:

<source>

The source tag contains the implementation of your symbol. For ease of coding, it is best to store the text within a <![CDATA[ .. ]]> section. The source section contains ASP style coding, see Scripting for details.

<shared>

The shared section is optional, allowing you to have functions that are available to all controls within this symbol library, rather than duplicating code between each control.

Using custom symbols

Your custom symbols can be used in any file on the website. To use the symbol, add the following code:

{Control:ControlName prop1="val1" prop2="val2"}