[FX.php List] Newbie Needs Help

Andy Gaunt andy at fmpug.com
Mon Oct 17 11:49:48 MDT 2005


Peter -

Here is a useful piece of code to alternate colors on table rows,
paragraphs, list items etc. It uses two style classes to alternate the row
colors for you.

Place the code below in your opening script (or in an include you use on all
pages)

<?
function alternate_colors() {
static $data_count;
$data_count++; 
if ($data_count % 2) {
echo "oddcolor";
}
else {
echo " evencolor ";
}
} 
?>

Now, your two styles

.oddcolor {
	background-color:#FFFFFF;
}
.evencolor {
	background-color:#EEEEEE;
}

Now, all you have to do on your table row is add the class

<tr class="<? alternate_colors(); ?>">Your data here </tr>

Andy Gaunt
T: 407.810.4722
andy at fmpug.com
http://www.fmpug.com
	
Recipient of FileMaker's 2005 "Mad Dog" Public Relations Award
 
October 27th 2005, 6pm Orlando FMPug - What's Hot for FileMaker Developers,
a presentation of FileMaker 8 Advanced features.
For other chapter locations, dates & times please visit the website at
http://www.fmpug.com
If you can make it to a meeting, please RSVP at
http://www.fmpug.com/rsvp.php


-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Peter Bates
Sent: Monday, October 17, 2005 1:36 PM
To: fx.php_list at mail.iviking.org
Subject: [FX.php List] Newbie Needs Help

Brief about myself: I've just started using FX.php, (I was using  
FileMaker's XSLT), for my custom web publishing. My knowledge of php  
is at the learning stages too. I have FX.php in 8 Hours, (book and  
video series), and FXForge 2.0.

I have been able to understand most of the code that is produced by  
FXForge, but when it comes to the code that is provided by Chris  
Hansen's examples that he provides, I quickly get lost, since his  
code is structured so much differently that the FXForge-produced  
code. I've been trying for weeks now to integrate two features that  
he provides in his index.php code into my search_results.php code  
without any success. If anyone could please help me understand how to  
do the following two items, I would be eternally grateful.

In his Book List Example, he shows:
1. The data rows displayed in alternating colors.
2. A "plain english" message is returned when no records are found.

That's it. I can see where in his code that he does this, but I just  
don't understand how to get the same results with my code. This is  
the only bit that I lack to consider my code to be complete. The URL  
for this is at:  http://fmcwp.sjcpl.org/tribindex/index.php

Peter Bates


_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list