Jump to content

static $i = 0;


Monkuar

Recommended Posts

$color_one = '</tr>'; 
   $color_two = '</td>'; 
   static $i = 0;
   $color = ($i % 2) ? $color_one : $color_two;
   $i++;

global $ibforums;
//caption is sname
return <<<EOF





<td width=33%><fieldset><legend>{$info['sname']}</legend>
<div class="p3">

 Added on {$info['date']} by {$info['author']}</a>
</div>
<table class="ftb">
<tr><td nowrap class="ce desc">

Public<br>
Views: {$info['views']}<br><br>
Rank: {$info['rating']}<br><br>

Comments: 0<br><br>
</td>
<td class="lc ib"><span class='linkthru'><a href="index.php?download={$info['id']}"><img src='{$info['screenshot1']}' border='0' align='center' width='100' height='100' /></a></span>
<br>
</td></tr></table>
</fieldset><br>
$color

 

How can I use:

$color_one = '</tr>'; 
   $color_two = '</td>'; 
   static $i = 0;
   $color = ($i % 2) ? $color_one : $color_two;
   $i++;

that Code to make  the above above code spit out 3 rows each then a break tag?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/164035-static-i-0/
Share on other sites

Sir please please give me that information, Im using old old code from 2002 but I  enahcned with u guys best code around!! :

 

So it would be like this?

 

$color_one = '</tr>'; 
$color_two = '</br>';
   static $i = 0;
   $color = ($i % 3) ? $color_one : $color_two;
   $i++;

Link to comment
https://forums.phpfreaks.com/topic/164035-static-i-0/#findComment-865362
Share on other sites

Not entirely sure what you mean but somethin like this

for($i = 0; $i < howmnylinesyouwnt; $i++)
{
echo '<tr><td>table row</td></tr>';
if($i % 3 == 0)
{
echo '<br />';
}
}

Althouh why you want a line break outside a table cell doesn't mke sense to me. And I doubt it's valid html.

Link to comment
https://forums.phpfreaks.com/topic/164035-static-i-0/#findComment-865511
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.