Widgets & Objects

Pearl uses widgets and objects to pull data into your site.

Widgets typically do the clever behind-the-scenes stuff such as produce and update the shopping cart element or spit out a drop-down menu based on your active categories. A widget uses the following syntax (in the case of the shopping cart): [#cart#]. Widgets are generally used in the index.html template, with a few exceptions of product-space widgets - such as [#buy#] which populates a drop-down menu of product options and appends an 'add to cart' buton. Widgets can also be passed variables such as the root category for a dynamic menu, or the number of products the featured products widget should display. They take the same format as HTTP GET: [#widget?var1=value&var2=value#].

Objects on the other hand are find-and-replace and will return strings of data such as a product name, description or price. They're differentiated from widgets by the percent symbol, but otherwise take the same form: [%price%].

There's one important exception to take note of: [%content%]. The content object lives in your index.html template, and defines where 'everything else' appears during parsing, including your product_listing.html and product.html templates. You will need to include the content object somewhere, otherwise your site will turn out rather lacking in content!

A full list of widgets and objects - and their functions and variables - is available in Appendix C - Widgets & Objects.