X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Hiding Code in Section (https://forum.x-cart.com/showthread.php?t=24998)

dalmuti 09-16-2006 07:18 PM

Hiding Code in Section
 
I am trying to add a space between each tab for a speedbar. I read other code and tried copying the idea and would like the space between tabs unless its the last tab and then no space because its right aligned and leaves a space and looks strange.

Here is the code:

Quote:

{if $speed_bar}
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR>
{section name=sb loop=$speed_bar}
{if $speed_bar[sb].active eq "Y"}
<TD>{include file="customer/tab.tpl" tab_title="<A href=\"`$speed_bar[sb].link`\">`$speed_bar[sb].title`</A>"}</TD>
{if not %sb.last%}
<TD width="2"><IMG src="{$ImagesDir}/spacer.gif" width="2" height="1" border="0" alt=""></TD>
{/if}
{/if}
{/section}
</TR>
</TABLE>
{/if}


What am I doing wrong?

Thanks,

Louise

willirl 09-18-2006 06:59 AM

Re: Hiding Code in Section
 
(Assuming that the TD code is correct) - If the last element(s) of the speed bar is(are) not active ("Y") then there will be a space after the last tab. I don't see a way to make it work in this case without doing a two pass type loop where you get the "active" tabs on the first pass then diisplay them on the second.

dalmuti 09-18-2006 07:31 AM

Re: Hiding Code in Section
 
That was it....I wasn't thinking about the last item not being active. Thank you for your reply.

Louise


All times are GMT -8. The time now is 12:40 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.