[FX.php List] Newbie Needs Help

Andy Gaunt andy at fmpug.com
Tue Oct 18 08:39:54 MDT 2005


Peter -

Glad it helped.

And it is re-useable code so when you need it again, just apply the class to
the elements you want to alternate colors. I include the function in an
included page that is called on every single page of the www.fmpug.com site,
so if I need or want to add it I can easily do so. 

In fact, you can add extra color choices by creating new color classes eg

.oddcolor_blue {
     background-color:# #CBDBDC;
 }
 .evencolor_blue {
     background-color:#EEEEEE;
 }

 and then appending to the class with the _color

"<? Alternate_colors(); ?>_blue"

An infinite set of possibilities!

Enjoy

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: Peter Bates [mailto:p.bates at sjcpl.org] 
Sent: Tuesday, October 18, 2005 10:15 AM
To: andy at fmpug.com; FX.php Discussion List
Subject: Re: [FX.php List] Newbie Needs Help

Andy,

Yesterday when I replied back saying there was something weird going  
on with my one file but not the other, I was wrong. I wasn't at work  
and I had asked someone else to enter your snippet in the one file.  
Today I gave it a try myself and it works great! Must of been a typo  
yesterday.

Thanks,
Peter
On Oct 17, 2005, at 12:49 PM, Andy Gaunt wrote:

> 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
>
> _______________________________________________
> 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