[FX.php List] Help needed to rewrite old FMP tags to PHP ( to achieve different table rows color )

Michael Layne fx at 9degrees.com
Tue Mar 29 23:40:09 MST 2005


Lars,

You may have already received some examples, but I use this all the  
time...

	$counter = 1
	foreach ($result['data'] as $list) {
		
		if ($counter % 2 == 0) {
		echo "<tr bgcolor=\"#f3f3f3\">\n";
		} else {
		echo "<tr>\n";
		}
		echo "<td>" . $list['pid::add1'][0] . "<br />" .  
$list['pid::city'][0] . " " . $list['pid::st'][0] . " " .  
$list['pid::zip'][0] . "<br />" . $list['pid::country'][0] . "</td>";
		echo "</tr>";
		++$counter;		// The '++' operator increments the argument it  
accompanies.
	}


pretty straight forward.

HTH.

Michael

On Mar 29, 2005, at 4:04 AM, Lars Arlér wrote:

> Hi and thanks in advance.
>
> What I try to achieve is to make every second table row different  
> color,
> Other solution or options are welcome
>
> Basically I need to make a include statement like this in PHP
>                       <tr [FMP-include:../rowcolor.TXT]>
> Would this work ??
>                       <tr <? include_once('rowcolor.PHP'); ?> >
>
> ----------------------------------------------------------------------- 
> -----
>  <? foreach($searchResult['data'] as $key=>$searchData){ ?>
> <table width="100%" border="0" cellpadding="2"cellspacing="0">
>
> <tr [FMP-include:../rowcolor.txt]>
>
>    <td><?php echo $value['recid'][0]; ?>
>            <? Echo $searchData['recid'][0]; ?></td>
>   <td><? echo $searchData['Headline'][0]; ?></td>
>   <td><? echo $searchData['category'][0]; ?></td>
>
> </tr>
> </table>
>     <? } ?>
> -----------------------------------------------------------------------
>
>
> --------------    included   rowcolor.TXT     
> -------------------------------
> [FMP-IF:
> CurrentRecordNumber .eq. 1] BGCOLOR="#DDDDDD"
> [FMP-Else]
> [FMP-IF:
> CurrentRecordNumber .eq. 3] BGCOLOR="#DDDDDD"
> [FMP-Else]
> [FMP-IF:
> CurrentRecordNumber .eq. 5] BGCOLOR="#DDDDDD"
> [FMP-Else]
> [FMP-IF:
> CurrentRecordNumber .eq. 7] BGCOLOR="#DDDDDD"
> [FMP-Else]
> [FMP-IF:
> CurrentRecordNumber .eq. 9] BGCOLOR="#DDDDDD"
>
> [/FMP-IF]
> [/FMP-IF]
> [/FMP-IF]
> [/FMP-IF]
> [/FMP-IF]
> ----------------------------------------------------------------------- 
> --
>
> --------------    included   rowcolor.PHP     
> -------------------------------
> If($CurrentRecordNumber ==`1`){`BGCOLOR="# DDDDDD"`); }
> else
> If($CurrentRecordNumber ==`3`){`BGCOLOR="# DDDDDD"`); }
> else
> If($CurrentRecordNumber ==`5`){`BGCOLOR="# DDDDDD"`); }
> Else
> If($CurrentRecordNumber ==`7`){`BGCOLOR="# DDDDDD"`); }
> else
> If($CurrentRecordNumber ==`9`){`BGCOLOR="# DDDDDD"`); }
> Else
> ----------------------------------------------------------------------- 
> --
>
>
> Lars Arlér
>
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>

Michael Layne  :  9 degrees development  :  www.9degrees.com  :   
404.226.7835
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2903 bytes
Desc: not available
Url : http://www.iviking.org/pipermail/fx.php_list/attachments/20050330/c21ad065/attachment.bin


More information about the FX.php_List mailing list