Raptor is proprietary to Aptos Digital Commerce and allows visual functionality to be added to HTML pages through the site manager. Aptos has built a parsing engine designed to parse XML documents using strict rules. In simple terms, it pulls in your HTML content, parses it as an XML document using, and then outputs it as an HTML document for browsers. In order to work properly, HTML documents must be properly formatted and follow strict markup standards. By using the templates accessible via File Transfer Protocol (FTP), developers can access and use the pre-defined codes to control virtually every aspect of a page. By utilizing the template auto-populate functionality in the editor, items like slideshows and pagination can be dropped into a page without the need for excessive programming.
You can access templates, CSS and JS for your site through the Site Manager at Content > Pages > Templates. It is advisable to utilize the editor within this section to maintain an audit trail. Developers should be familiar with HTML and Scripting concepts.
There are three types of nodes that are parsed by the Aptos Digital Commerce platform. These nodes are: fields, functions and caches.
Example: Featured Content Block
The field below will output the FeaturedContent (Featured Content Block) for the Mobile (Group Mobile) with the title "Header-Links".
<field type="FeaturedContent.Mobile.Header-Links" /> Example: Sells For Price This field will output the current Product.Sale (Sells For) price of the product formatted as currency.
<field type="Product.Sale" formatter="currency" /> Multiple fields can be used in a template and they can be used both with, and without, functions.
Function nodes allow for more advanced types of content. These can be anywhere from comparisons and calculations, to looping through results of data. A function can have multiple attributes associated with it depending on the specifics for the function you are working with.
Example: Comparing Sale v. On Sale Pricing This function type shown below (Custom.Compare), compares the database Value1 for Product.Sale (Sells For) with Value2 Product.Sale_Special (On Sale) pricing for the product.
<function type="Custom.Compare" Value1="Product.Sale" Value2="Product.Sale_Special">
So, if the Value1 Product.Sale, is greater than or equal to Value2, it will use template.
<function type="Custom.Compare" Value1="Product.Sale" Value2="Product.Sale_Special"> <template> <span id="displayAmount"><field type="Product.Sale_Special" formatter="Currency" /></span> </template>
If Value1 is less than Value2, it will use the elsetemplate. It will then replace the content within the node it is using and will parse any fields or functions within that node.
<function type="Custom.Compare" Value1="Product.Sale" Value2="Product.Sale_Special"> <elsetemplate> <span class="regular"><field type="Product.Sale" formatter="Currency" /></span> </elsetemplate> </function>
Loops are even more advanced functions. They enable more precise specifications for the fields being called. In short, they guide the way.
Example: Looping through Sub-Categories under a Category This is an example of a loop placed on a Category page. It will loop through the Sub-Categories which are directly under the category.
In this function, the content for template is used for each of the Sub-Categories which reside under the Category. Some of the data that is being replaced are fields associated with the Sub-Category.
The content in href is listed as <field type="SubCategory.SubCategoryUrl" /> for example. This is done in this manner to ensure it is XML compliant and will be replaced while looping the content.
<function type="Category.SubCategory.Loop" mobileOnly="true" sortOrder="DeptOrder,Dept_Alt"> <template> <li><a title='<field type="SubCategory.Dept_alt" />' href='<field type="SubCategory.SubCategoryUrl" />'><field type="SubCategory.Dept_alt" /></a></li> </template> </function>
<function type="Product.Loop" modConditional="3" insertAtConditional="1" reuseData="true"> <insertAt_1>This content gets inserted in the position specified in the insertAtConditional attribute </insertAt_1> <mod_3>This content gets inserted in the every loop count that divisible by 3</mod_3>
<cache cacheName="homePageContent"> <div id="left_nav" class="basewrap"> <function type="Include" file="searchbox2.htm" /> <field type="FeaturedContent.Homepage.LeftNav" /> <field type="FeaturedContent.Homepage.LN1" /> <field type="FeaturedContent.Homepage.LN2" /> <field type="FeaturedContent.Homepage.LN3" /> </div> </cache>
Cache will expire in 2 days by default. You can override this behavior by using cacheExpiry attribute.
<function type="Category.SubCategory.Loop" cacheExpiry="1d6h30m">
In this case the cache for this function will expire in 1 day, 6 hours and 30 minutes.
Working with CDATA
CDATA is very useful when working within JS to loop and output JS variables using Raptor as JS is not proper XML.
<function type="Custom.Contains" Value1="Request.URL.PageName" Value2="cart.aspx">
<function type="Cart.Loop" max="#" sortOrder="Row_ID Asc" > <template>
//<Unable to render embedded object: File ([CDATA[_ltk.SCA.AddItemWithLinks(']]><field type="Cart.Part_No" /><) not found.[CDATA[', ']]>
<field type="Cart.Quantity" /><Unable to render embedded object: File ([CDATA[', ']]><field type="Cart.Total" /><) not found.[CDATA[', ']]>
<field type="Cart.ProductName" /><Unable to render embedded object: File ([CDATA[', '/images/t09fa.jpg', ']]>
<field type="Cart.Original_URL" /><) not found.[CDATA['); // one line per item]]>
</function> <![CDATA[//_ltk.SCA.Submit(); </script> ]]>