vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   alternating row color (https://vborg.vbsupport.ru/showthread.php?t=35497)

DjSap 02-27-2002 11:36 AM

alternating row color
 
Im trying to make a classifieds hack for my board and i want to list all results in a table, it works fine but i can't get the row colors to alternate so that both second and firstaltcolor is used, ive tried to do it according to some tutorials but it doesnt seem to work on vb.

This is my query for displaying a list of the ads

PHP Code:

$clsbit $DB_site->query("SELECT adid, price, userid, title, timeline, category FROM classified ORDER BY adid DESC LIMIT 5");
while (
$admessage=$DB_site->fetch_array($clsbit)) {
$adid $admessage[adid];
$userid $admessage[userid];
$date vbdate("m-d-Y H:i",$admessage[timeline]);;
$title $admessage[title];
$price $admessage[price];
$catid $admessage[category];
$userinfo=getuserinfo($userid);
$cat=$DB_site->query("SELECT category FROM classified_category WHERE catid='$catid'");
list(
$category) = mysql_fetch_row($cat);
eval(
"\$classifiedbit .= \"".gettemplate("classifiedbit")."\";");


So could someone tell me what i should write to get alternating row colors working.

Admin 02-27-2002 12:05 PM

See my thread in the Hints and Tips forum.

mrbaseball34 09-04-2002 02:34 PM

You mentioned a thread about alternating row colors in the
hints/tips forum but I could not find it.

I'd like to replace my XMB board with a VBulletin board but want to keep the same scheme, like the screenshot below.

http://www.austinmetrobaseball.com/b...screenshot.gif

tHE DSS 09-04-2002 05:10 PM

For anything like this, you can use a function similar to the following :

PHP Code:

// check if value is EVEN function
function isEven($value) {
    return 
$result = ($value == 0) ? (true) : (false);
}

// usage example
$counter 0;
while (
$counter++ <= 10) {
    if (
isEven($counter)) {
        
// counter is an EVEN number, output, BLAH BLAH #01
    
} else {
        
// counter is NOT EVEN number, output BLAH BLAH #02
    
}


... basically, doing a 'modulus' operator divides 'x' by 'y', and returns the remainder.... as be do a modulus 2, if the number is not directly divisable by 2 (doesn't return a remainder of 0), then the number is not even, otherwise, it is.

Using that technique, you can display alternate stuff, depending on a counter being ODD or EVEN.

mrbaseball34 09-05-2002 12:53 PM

I *know* how to do it, it's just *where* in the vB code I need to.

As you can see, I was able to do it to XMB. FireFly posted that
he had a completed mod and I couldn't find the post. I was just
asking where to get the mod...


All times are GMT. The time now is 07:33 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01066 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete