1
dbbis
Table with rows of two alternative colors ?
  • 2003/11/6 13:41

  • dbbis

  • Just popping in

  • Posts: 12

  • Since: 2003/1/20


Hi!

To be a bit more understandable, just look at this example, at Apple's website, the table on the middle of the page:

http://www.mac.com/1/iTour/tour_addressbook.html

Would it be possible to do the same for Xoops?
IE:
- one white row;
- one blue row;
- one white row;
- etc.

Thanks in advance and best regards,

Don.

2
blueangel
Re: Table with rows of two alternative colors ?
  • 2003/11/6 14:22

  • blueangel

  • Module Developer

  • Posts: 132

  • Since: 2002/2/20


you can use the feature of smarty templates to obtain this

for example i report here a part of code of the block of the newbb module "show recent discussion"

<{foreach item=topic from=$block.topics}>
  <
tr class="<{cycle values="even,odd"}>">
    <
td><a href="<{$xoops_url}>/modules/newbb/viewforum.php?forum=<{$topic.forum_id}>"><{$topic.forum_name}>a>td>
    <
td><a href="<{$xoops_url}>/modules/newbb/viewtopic.php?topic_id=<{$topic.id}>&forum=<{$topic.forum_id}>"><{$topic.title}>a>td>
    <
td align="center"><{$topic.replies}>td>
    <
td align="center"><{$topic.views}>td>
    <
td align="right"><{$topic.time}>td>
  tr>
  <{/foreach}>


then you need to define the classes odd and even of two different color in the css of your theme and you reach the result

3
ibzan
Re: Table with rows of two alternative colors ?
  • 2003/11/6 14:22

  • ibzan

  • Just popping in

  • Posts: 48

  • Since: 2003/8/31


You can easily do this in a couple of steps.

First you need to set a style, either directly in the page, or within the style sheet file for the theme you are using (aptly named style.css)

Create two classes (for example):

.blue
.white

The period is necessary because it defines this style as a class which you can later add to your row's tag.

For each class define their respective styles, in this case you would have something similar to:

.blue {background-color: #0000FF;}
.white {background-color: #FFFFFF;}

Now that you have this defined you can move on to the having XOOPS handle the cycling of the different classes on your row.

In a template or on the theme file, etc., you will need change the variables for your table row and should end up with something like:

class="<{cycle values="blue,white"}>">

Traditionally you you have had to do this row by row (i.e. class="blue" then on the next row, class="white", etc.), or used javascript to handle this, however XOOPS takes care of this nicely via the "cycle values."

Note: don't forget both brackets AND both braces.

Chris

4
dbbis
Re: Table with rows of two alternative colors ?
  • 2003/11/6 16:24

  • dbbis

  • Just popping in

  • Posts: 12

  • Since: 2003/1/20


Thank you very much!

Cheers,

Don.


Login

Who's Online

318 user(s) are online (236 user(s) are browsing Support Forums)


Members: 0


Guests: 318


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits