Understanding Tags a bit Better...

General ShopSite user discussion

Understanding Tags a bit Better...

Postby ajhauser » Tue Dec 06, 2011 11:06 pm

Hello Everyone,
Let me preface this by saying I am completely new to ShopSite and working through my first storefront.
The store in question can be found at: http://brotherscountrysupply.com/store/

I am having a hard time finding specifics in the forum, so I hope it's ok that I'm posting new topics.
I have ShopSite Pro and a LAMP stack for this store:

I am trying to work my way through a series of custom templates, and remove all the TABLE TAGS to replace them with DIVS or standard HTML wherever possible. I just made the following change to the loop links tag default from the cookbook:

Code: Select all
[-- LOOP LINKS PAGE.Columns --]


------to------->

Code: Select all
[-- LOOP LINKS --]


This was the only way that I could generate a list of links inline without <tr> tags. The results can be seen on my page, and I have read the help description - but I don't understand why the "[-- LOOP LINKS PAGE.Columns --]" adds the table tags. Is that something that is defined ahead of time within that command? Please excuse me if my terminology is way off...

The end result for what I was trying to get was this:
Code: Select all
[-- IF PAGE.NumLinks 0 --]
 [-- ELSE --]
      <div class="GeneratedProductList">
      Other pages and products you may wish to view:<br />
 [-- LOOP LINKS --]
 [-- LINK --] |
 [-- END_LOOP LINKS --]
      </div><!-- GeneratedProductList -->
 [-- END_IF --]


If someone could also explain what this does in layman's terms, and why it's an if / else statement it would really help out as well.
Code: Select all
[-- IF PAGE.NumLinks 0 --]


Thanks very much!
Website Design, Website Development, eCommerce and Hosting
ajhauser
 
Posts: 84
Joined: Tue Dec 06, 2011 4:18 pm
Location: Earlville - the land of Earls

Re: Understanding Tags a bit Better...

Postby Jim » Wed Dec 07, 2011 7:05 am

The basic tag to display links is
[-- LOOP LINKS --]
you can make the links display in columns instead of a single long list by adding a numeric value to the tag so it becomes
[-- LOOP LINKS <number of columns> --]
The <number of columns> part could be added by using a plain number, 2, 3, 6 or whatever value you want or you could use a value from the database such as the page.columns which is set on the Pages > Edit Page layout screen. By using the page.columns value the template is more flexible since you could use the same template for multiple pages but have the number of columns of links change based on the value of the Columns field set for the page.

One way to get multiple columns is to have the content in a table and set up <td>s for the various columns. So when the column number parameter is added to the loop_links tag a table is created with a <tr> and how ever many <td>s are required to make the specified number of columns for the links to be placed in.

The tag [-- IF PAGE.NumLinks 0 --] would be checking if there are any links to be put on the page. If there are no links on the page then certain coding would be unnecessary so it will be left off the page.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: Understanding Tags a bit Better...

Postby ajhauser » Wed Dec 07, 2011 11:17 pm

Awesome - now I get it and it's working.
Many thanks!!!
Website Design, Website Development, eCommerce and Hosting
ajhauser
 
Posts: 84
Joined: Tue Dec 06, 2011 4:18 pm
Location: Earlville - the land of Earls


Return to User Forum

Who is online

Users browsing this forum: No registered users and 36 guests

cron