Support Forums

Old 06-25-2006, 12:15 PM   #1
Senior Member
 
gregbatch's Avatar
 
Join Date: Jun 2006
Posts: 172
Rep Power: 16
gregbatch is on a distinguished road
Default Alternating row colors?

I see in the CSS that there is a section for altertnating row color, yet it doesn't display on the site. Any ideas what needs changing or what look for?
gregbatch is offline   Reply With Quote
Old 06-25-2006, 06:06 PM   #2
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,221
Rep Power: 61
juven14 is a jewel in the rough
Default

HTML Code:
<td class="{cycle values="row1,row2" advance=false}">some text</td>
<td class="{cycle values="row1,row2" advance=false}">some text</td>
<td class="{cycle values="row1,row2" advance=true}">some text - last cell in row.</td>
This is an example of how to alternate rows. This is within a smarty loop. You can specify row1 or row2 for any other purpose.
__________________
John Snyder
PHP Developer
juven14 is offline   Reply With Quote
Old 06-25-2006, 06:10 PM   #3
Senior Member
 
 
Join Date: Mar 2006
Posts: 110
Rep Power: 16
sleepy will become famous soon enough
Default

John,

Where abouts does the code in your last post go?

sleepy
sleepy is offline   Reply With Quote
Old 06-25-2006, 06:18 PM   #4
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,221
Rep Power: 61
juven14 is a jewel in the rough
Default

I copied this from userbrowselistings.tpl.php and removed the cell content. you can put it in any foreach loop in the templates.

You might use this for any number of forms as is done in the administration panel.

HTML Code:
 {foreach from=$results item="entry"}
  <tr>
      <td class="{cycle values="row1,row2" advance=false}">{$entry.something}</td>
      <td class="{cycle values="row1,row2" advance=false}">{$entry.something}</td>
      <td class="{cycle values="row1,row2" advance=true}">{$entry.something}</td>
  </tr>
{/foreach}
Everytime it loops to the next row it will alternate background colors.
__________________
John Snyder
PHP Developer

Last edited by juven14; 06-25-2006 at 06:25 PM.
juven14 is offline   Reply With Quote
Old 06-26-2006, 05:13 AM   #5
Senior Member
 
gregbatch's Avatar
 
Join Date: Jun 2006
Posts: 172
Rep Power: 16
gregbatch is on a distinguished road
Default

OK. I found that, tried it and it worked, but then it overrides the highlighted ads. Is it a either/or situation?
gregbatch is offline   Reply With Quote
Old 06-26-2006, 08:46 AM   #6
Coder
 
Join Date: Mar 2006
Posts: 4,589
Rep Power: 111
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by gregbatch
OK. I found that, tried it and it worked, but then it overrides the highlighted ads. Is it a either/or situation?
I beleive that is the case. The reason being is that both the featured ads and the alternating row colors rely on the style sheet to set the background color. Depending on where you are trying to incorporate the alternating row colors there is a possibility that you could include some smarty logic in the template to check and see if an ad is featured and if it is display the default featured ad style sheet.

Can you post a chunk of code you implemented and the name of the file you used it in?
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 06-26-2006, 09:24 AM   #7
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,221
Rep Power: 61
juven14 is a jewel in the rough
Default

Try something like this:
HTML Code:
{if $entry.class=="featured"} class="{$entry.class}"{else} class="{cycle values="row1,row2" advance=false}"{/if}
__________________
John Snyder
PHP Developer

Last edited by juven14; 06-26-2006 at 09:33 AM.
juven14 is offline   Reply With Quote
Old 05-26-2009, 04:32 AM   #8
Member
 
Join Date: Apr 2009
Posts: 52
Rep Power: 3
JP2 Designs is on a distinguished road
Default

Quote:
Originally Posted by juven14 View Post
Try something like this:
HTML Code:
{if $entry.class=="featured"} class="{$entry.class}"{else} class="{cycle values="row1,row2" advance=false}"{/if}
I tried this but it overrun the featured class and did not rotate the row1 - row2 either...

For example: Trading Hub Classifieds Australia Arts/ Craft, Hobbies Paintings

the top two should be featured ads.

my code looks like:

HTML Code:
	{foreach from=$results item="entry"}
	<tr>
	  {if $sDisPhoto == "Y"}
	  <td{if $entry.class=="featured"} class="{$entry.class}"{else} class="{cycle values="row1,row2" advance=false}"{/if}><a href="{$entry.link}" title="{$entry.title}">{if $entry.image != ""}<img src="thumbs/small_{$entry.image|escape:"url"}" border="0" alt="{$entry.title}" />{else}<img src="templates/{$smarty.const.MAIN_TEMPLATE}/images/nophotosmall.gif" border="0" alt="{$entry.title}" />{/if}</a></td>
	  {/if}
          {if $sDisTitle == "Y"}
          <td{if $entry.class=="featured"} class="{$entry.class}"{else} class="{cycle values="row1,row2" advance=false}"{/if}><a href="{$entry.link}" title="{$entry.title}">{$entry.title}</a></td>
          {/if}
          {if $sDisPrice == "Y"}
          <td{if $entry.class=="featured"} class="{$entry.class}"{else} class="{cycle values="row1,row2" advance=false}"{/if}>{$entry.price|format_money}</td>
          {/if}
	</tr>
	{foreachelse}
I also searched "alternating" as well but it seams everyone else has the same problem.
__________________
Jermayn Parker
v4.1.3 Developer
using deapsea as a template for hack m y own
JP2 Designs is offline   Reply With Quote
Old 05-26-2009, 04:42 AM   #9
Senior Member
 
 
Join Date: Jan 2007
Posts: 383
Rep Power: 19
michael is a jewel in the rough
Default

Quote:
I tried this but it overrun the featured class and did not rotate the row1 - row2 either...
JP. You may not have noticed but this thread was started - 3 years ago - in the days of version 3. We've come a long way baby!

Others may come along with a more knowledgeable answer but I believe the alternating rows are controlled by your CSS file. The following is a section I've copied from my own:

/* Featured Listings
* td.featured handles the display of featured listings
*
*/
td.featured { background-color: #F1F1F1; }

/* Bold Listings
* td.bold handles the display of bold listings
*
*/
td.bold { font-weight: bold; }

/* Highlighted Listings
* td.highlighted handles the display of highlighted listings
*
*/
td.highlighted { background-color: #CCCCFF; }

/* row1 & row2
* This section handles alternating rows

*
*/
.row1 { background-color: #d0d0d0; background-color: #F1F1F1; }
.row2 { background-color: #FFF; }
__________________
M Michael
V4.1.3 Developer - 3 Column Default Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
michael is offline   Reply With Quote
Old 05-26-2009, 06:09 AM   #10
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 867
Rep Power: 23
bowers01 is on a distinguished road
Default

I just use:
<tr bgcolor="{cycle values="#eeeeee,#FFFFFF"}">
Nick
__________________
Nick Bowers
68c v4.09 Developer Custom Template
bowers01 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alternating background colors in search results view spaceboy v3.1 Modules & Modifications 1 09-19-2006 09:19 AM
Highlighted and Standard Colors garysmith v3.0 Questions & Support 6 03-29-2006 07:42 PM


All times are GMT -4. The time now is 12:10 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0