template cookbook

Custom Page Templates: Page Links

There are two separate parts of a custom page template for page links: defining how page links look, and setting where links will be displayed in the current template.

Defining the Link to The Page

You must define how links to a page will look at the top of your custom page template, before the [-- DEFINE PAGE --] tag. This is a critical area of template design, because the look and layout of page links should work with the rest of your layout and provide easy navigation.

By default, this link definition will be used for any page that uses the template, wherever links to those pages appear. In other words, if page A is built with template A, the links to page A will be built with the link definition from template A, even if they appear on a page built with a different template. You can override this default action and specify that all links on a page be built with the same template, regardless of what templates are associated with those pages.

a

Merchants have quite a few options that they can set for page links, and you can choose to use or ignore any of them in your template:

Because of the number of elements to consider, the page link portion of a template can be rather complicated. You may want to ignore some of the elements, such as the link graphic or the link text.

Putting Links on the Page

Putting links on your page can be much easier than defining how the links will look. At its simplest, you can use this loop:

You will probably put some HTML tags in and around the loop tags to format the links to fit your page layout.

Page Link Example 1
This example template uses the link name for the page link if it's defined, otherwise it uses the page name. It completely ignores the link graphic, link text, and text wrap settings. The [-- LOOP LINKS --] section contains a <br> tag to put each link on it's own line. You would need to replace mytemplatename in the [-- LINK --] tag with the name of your template.

Page Link Example 2
This second example template uses the link name, link graphic and link text. It uses IF tags to test whether each field has a value before putting it on the page. It also uses an embedded CSS style sheet to apply the link colors set by the merchant. It ignores the text wrap settings.

Page Link Example 3
The second example template still has some problems. What if the merchant didn't set a link name or graphic? There isn't any code to use the page name instead. What about text wrap? Text wrap can make the code more complicated.

The code below is not a complete page template. It is just code for defining a page link that can handle all of the possible combinations. This is the same code that is used by the ShopSite Rounded and Sidebar templates, and it already exists as an "include" file in ShopSite. If you'd like to use this code in your template, you can either copy it from this page and paste it into your template, or just use an [-- INCLUDE --] tag, like this:


Here's an explanation of the logic:

  1. Set a variable to track when a link is actually put on the page.
  2. If text wrap is off and if there is a link graphic, create a table and put the link graphic in the first cell. Create the second cell, but don't put anything in it yet. (The two cells keep the graphic and link text separate so the text does not wrap under the graphic.) Set the variable to Yes to show that a link was placed on the page.
  3. If text wrap is on and there is a link graphic, put the graphic on the page. Set the variable to Yes.
  4. If there is a link name, put it on the page and set the variable to Yes.
  5. If there is link text and the variable has been set to Yes, put the link text on a new line.
  6. If there is link text and the variable is still set to No, make the text a link to the page.
  7. If the variable is still set to No, that means that there is no link name, link graphic, or link text defined, so use the page name as a link.
  8. If text wrap is off and there is a link graphic, close the second cell and the table.
Return To: Page Template Home Page

Top Template Tips

New v11 SP1 Template Tags Check out the new template tags available in ShopSite version 11 SP1. Custom Cart - No Template Get your own custom shopping cart look without learning how to create a shopping cart template. Quick & Easy Templates Copy and paste ready-made tables into your design to quickly create your own custom templates. Divided Customer Text-Entry Create multiple text fields for your customers to enter in product specific information. Multi-Add-To-Cart Template Setup a form where customers can add multiple items to the cart at the same time. View More Most Popular

Custom Template Forum

Check out the Custom Template Forum in the list of ShopSite User Forums. This forum is specifically for template questions and is monitored by two designers and is frequently viewed by other companies and designers. Post questions about custom templates and post unique tricks you have done with your custom templates.

Custom Template Forum
© 2012 ShopSite, Inc.|ShopSite Shopping Cart Software|Questions?|Site Map