- Posts: 9
COMMUNITY FORUM
Odd/even classes on items listed in category view
- Mister Andreas
- Topic Author
- Offline
- New Member
Less
More
14 years 3 months ago #85016
by Mister Andreas
Odd/even classes on items listed in category view was created by Mister Andreas
Hi everyone!
I wan't to show every second item in category view listings with a different background color. For example:
First item in the list is white then the secound would be gray, and the third is white again and so on....
Thanks in advance!
I wan't to show every second item in category view listings with a different background color. For example:
First item in the list is white then the secound would be gray, and the third is white again and so on....
Thanks in advance!
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
14 years 3 months ago #85017
by william white
Replied by william white on topic Odd/even classes on items listed in category view
Can you call the
/* --- Zebra rows --- */
.even {background:#fffff0;padding:2px;border-bottom:1px dotted #ccc;}
.odd {background:#fff;padding:2px;border-bottom:1px dotted #ccc;}
in your category.php in a similar way that they are used in the item.php
/* --- Zebra rows --- */
.even {background:#fffff0;padding:2px;border-bottom:1px dotted #ccc;}
.odd {background:#fff;padding:2px;border-bottom:1px dotted #ccc;}
in your category.php in a similar way that they are used in the item.php
Please Log in or Create an account to join the conversation.
- Mister Andreas
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
14 years 3 months ago #85018
by Mister Andreas
Replied by Mister Andreas on topic Odd/even classes on items listed in category view
Yes that is possible but I have to have som phpcode to determine either the catitem view id(or item id...something) is odd or even and then setting the class to odd/even.
Please Log in or Create an account to join the conversation.
- Emmanouil
- Offline
- Senior Member
Less
More
- Posts: 58
13 years 7 months ago #85019
by Emmanouil
Replied by Emmanouil on topic Odd/even classes on items listed in category view
Hello Mister Andreas,
did you manage to solve this? Is there any upadate?
Thanks in advance.
did you manage to solve this? Is there any upadate?
Thanks in advance.
Please Log in or Create an account to join the conversation.
- Jan Surovy
- Offline
- New Member
Less
More
- Posts: 1
12 years 1 month ago - 12 years 1 month ago #85020
by Jan Surovy
Replied by Jan Surovy on topic Re: Odd/even classes on items listed in category view
Hi guys,
I managed to solve it, thanks to William's clue. Thank you.
Open up the file root/components/com_k2/templates/default/category.php
- replace default if you use separate k2 template
Find
<div class="itemContainer
- choose if you want to affect leading or primary items
Paste following code just behind "itemContainer
<?php echo ($key%2) ? "odd" : "even"; ?>
- leave blank space on each side of this code if there's another class in the neighborhood
In my case, it does the job.
I managed to solve it, thanks to William's clue. Thank you.
Open up the file root/components/com_k2/templates/default/category.php
- replace default if you use separate k2 template
Find
<div class="itemContainer
- choose if you want to affect leading or primary items
Paste following code just behind "itemContainer
<?php echo ($key%2) ? "odd" : "even"; ?>
- leave blank space on each side of this code if there's another class in the neighborhood
In my case, it does the job.
Please Log in or Create an account to join the conversation.