Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Looping

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-20-2005, 07:16 AM
 
whsu716 whsu716 is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 168
 

Default Looping

Hello All!

Below is part of my products.tpl file...
what do: gt & lt stand for?



Quote:

{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")}
{include file="customer/main/products_tTest.tpl" products=$products}


{
__________________
...
v 4.0.18; 4.1
Reply With Quote
  #2  
Old 06-20-2005, 07:17 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Greater Than and Less Than
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 06-20-2005, 08:20 AM
 
whsu716 whsu716 is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 168
 

Default

hahah that was simple. Thanks.

Now here is the actual looping question. Below is taken from my products_t.tpl...

Quote:
{* $Id: products_t.tpl,v 1.10.2.7 2004/12/23 09:11:59 max Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" class="VertMenuBorder"><TR><TD class="TableThumbnailBorder">

<TABLE border="0" width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<TR>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<TD align="center" valign="top" width="{$width}%" class="DialogBox">

It loops through ALL featured products, but I just want it to take only 3 products...any thoughts?
__________________
...
v 4.0.18; 4.1
Reply With Quote
  #4  
Old 07-10-2005, 07:02 PM
 
whsu716 whsu716 is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 168
 

Default

Maybe this one is easier to answer...

Quote:
<table border="0" cellpadding="0" cellspacing="0" width="760px" style="margin-top: 1px; border-bottom: 1px solid #cccccc; padding-bottom: 7px;">
<tr>
<td style="margin-left: 2px;" align="right">
{section name=sb loop=$speed_bar }
{if $speed_bar[sb].active eq "Y"}
{include file="customer/tabTest.tpl" tab_title="<A href=\"`$speed_bar[sb].link`\">`$speed_bar[sb].title`</A>"}
{/if}
{/section}
</td>
</tr>
</table>

As of now, it prints every speed bar onto one line...like this:

line1 line2 line3 line4 line5 line6 line7 line8


But I would like this:

line1 line2 line3 line4
line5 line6 line7 line8
__________________
...
v 4.0.18; 4.1
Reply With Quote
  #5  
Old 07-13-2005, 08:09 PM
 
whsu716 whsu716 is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 168
 

Default

anyone???
__________________
...
v 4.0.18; 4.1
Reply With Quote
  #6  
Old 07-13-2005, 08:13 PM
 
Gibberish Gibberish is offline
 

Senior Member
  
Join Date: Sep 2003
Posts: 182
 

Default

Maybe something like this?
Code:
<table border="0" cellpadding="0" cellspacing="0" width="760px" style="margin-top: 1px; border-bottom: 1px solid #cccccc; padding-bottom: 7px;"> <tr> <td style="margin-left: 2px;" align="right"> {section name=sb loop=$speed_bar } {if $speed_bar[sb].active eq "Y"} {include file="customer/tabTest.tpl" tab_title="<A href=\"`$speed_bar[sb].link`\">`$speed_bar[sb].title`</A>"} {if %sb.index% is div 4} {/if} {/if} {/section} </td> </tr> </table>
__________________
Gibberish
[Unix] X-Cart 4.0.12
Reply With Quote
  #7  
Old 07-14-2005, 03:25 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default

Quote:
Originally Posted by yoyonation
hahah that was simple. Thanks.

Now here is the actual looping question. Below is taken from my products_t.tpl...

Quote:
{* $Id: products_t.tpl,v 1.10.2.7 2004/12/23 09:11:59 max Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" class="VertMenuBorder"><TR><TD class="TableThumbnailBorder">

<TABLE border="0" width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<TR>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<TD align="center" valign="top" width="{$width}%" class="DialogBox">

It loops through ALL featured products, but I just want it to take only 3 products...any thoughts?


Change the line
Code:
{section name=product loop=$products}

to

Code:
{section name=product loop=$products max=3}
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:48 PM.

   

 
X-Cart forums © 2001-2020