Glossary Item Box
Overview
Links can be added to your storefront to link to products, categories, external URLs, content (for custom pages), and more. They are controlled by records in your Links table, and can be grouped into Primary, Secondary, or Tertiary link sections:
Each theme can be configured to display it's own Links.
Displaying Links
Links in Squirrelcart were designed as an easy way to group links that have a common purpose, and do not necesarrily need to be inside a Navigation Block. A good example of this are links that appear in a header or footer area.
Displaying All Primary Links Using the Built in Main Menu Navigation Block
Squirrelcart has a special built in Primary Links (Main Menu) navigation block, which by deafult will display links assigned as Primary Links. It appears by default as the first navigation block on the left in the master Squirrelcart theme. If you started off with an older version of Squirrelcart and upgraded, this navigation block may not be assigned to your theme. If you add links as Primary Links and they are not appearing on your storefront, you can easily add them by adding this special navigation block to your theme. See the Navigation Blocks > Adding to Storefront topic for instructions on how to do this.
Displaying All Primary Links inside a Custom Navigation Block
The default master squirrelcart theme will automatically display any links assigned as Primary Links. It does so via a built in Navigation Block named Primary Links (Main Menu) which by default appears in the upper left hand corner of your storefront page. If you started using Squirrelcart with version 3.0.3 or newer all you need to do to add Primary Links to your storefront page is to add them to the Primary Links section inside the Links fieldset on your custom theme record (or on the Squirrelcart theme record).
If you do not have this navigation block in your installation, you can add it as follows:
![]() |
The navigation block mentioned above will NOT display unless you've added at least one link as a Primary Link. |
Displaying All Links Assigned to a Link Section
The recommended code to display all links assigned to the "Primary" links section is as follows:
<?php $Links = sc_links('Primary'); ?>
<?php foreach($Links as $Link): ?>
<a id="<?php print $Link['id'] ?>" class="<?php print $Link['CSS_Class'] ?>" href="<?php print $Link['URL'] ?>" target="<?php print $Link['Target'] ?>"><?php print $Link['Label'] ?></a><br/>
<?php endforeach; ?>
That code can be placed in any Squirrelcart template file, Content record, or Navigation Block record.
If you'd like to display Secondary or Tertiary links instead, use the same code but change 'Primary' to 'Secondary' or 'Tertiary'
If you wish to have the links appear on all pages, the best template to place this code in is your main storefront page template.
Sample HTML output resulting from the code above:
<a id="sc-link-1" class="home_link" href="http://www.example.com">Home</a><br/>
<a id="sc-link-2" class="products_link" href="http://www.example.com/categories/">Products</a><br/>
<a id="sc-link-3" class="about_link" href="http://www.example.com/content/about">About</a><br/>
<a id="sc-link-4" class="contact_link" href="http://www.example.com/contact.htm">Contact</a><br/>
<a id="sc-link-5" class="news_link" href="http://www.example.com/news/">News</a><br/>
<a id="sc-link-6" class="faqs_link" href="http://www.example.com/faqs.htm">FAQs</a><br/>
Displaying a Single Link
If you would like to display a single link in your storefront without it being nested inside a link section, you can do so by adding code to your main storefront page template as follows:
<?php
// display link with record number "123"
print sc_link(123,'tag');
?>
That code can be placed in any Squirrelcart template, Content record, or Navigation Block. It will output a single anchor tag corresponding to the settings for the Link record numbered 123:
<a id="sc-link-1" class="home_link" href="http://www.example.com">Home</a>
© 2001-2017 Lighthouse Development. All Rights Reserved.