Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Help for a CF noob

LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

I want to write a toggle color switch into a CF page with a data table on it
something like this PHP -

<tr<? $toggle=!$toggle; echo($toggle?' class="even"':' class="odd"'; ?>>

What would that look like in CF?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications

Views

916
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

>I want to write a toggle color switch into a CF page with a data table on
>it
> something like this PHP -
>
> <tr<? $toggle=!$toggle; echo($toggle?' class="even"':' class="odd"'; ?>>
>
> What would that look like in CF?

I'd use the current row of the recordset instead of setting another toggle
variable in a data table:

<tr class="#IIF(rs.CurrentRow MOD 2, DE('odd'), DE('even'))#">

--
Tom Muck, Adobe Community Expert
Dreamweaver Extensions/Articles -- http://www.tom-muck.com/
Cartweaver Development Team - http://www.cartweaver.com/
Extending Knowledge Daily - http://www.communitymx.com/


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

.oO(Murray *ACE*)

>That's cool. I may do that, then! Thankee....

Eh, not really ... if it's a static table you would be better off with
hard-coding the 'odd' and 'even' classes (although only one of them is
really necessary). Your posted code only makes sense in a loop, as Tom
pointed out.

Too bad CSS3 is still years away from being widely usable ...

Micha

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

I see what you mean. I only need to class every other row in combination
with a <tr> selector, e.g.,

tr { background-color:red; }
tr.special { background-color:green; }

I just don't have the time or energy to manually add classes to hundreds of
rows of existing tabular content on tens of pages - do you?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Michael Fesser" <netizen@gmx.de> wrote in message
news:f2c4c3l00pae70qrm6e3mp51m3a2pinfmd@4ax.com...
> .oO(Murray *ACE*)
>
>>That's cool. I may do that, then! Thankee....
>
> Eh, not really ... if it's a static table you would be better off with
> hard-coding the 'odd' and 'even' classes (although only one of them is
> really necessary). Your posted code only makes sense in a loop, as Tom
> pointed out.
>
> Too bad CSS3 is still years away from being widely usable ...
>
> Micha


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

There is no recordset. It's a static page in a curiously CF site (all to
only use cfincludes) that I have been asked to 'fix'. So - would it be -

<tr class="#IIF(toggle/mod2, DE('odd'), DE('even'))#">#toggle = !toggle#

?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
news:f9sphs$sis$1@forums.macromedia.com...
> >I want to write a toggle color switch into a CF page with a data table on
> >it
>> something like this PHP -
>>
>> <tr<? $toggle=!$toggle; echo($toggle?' class="even"':' class="odd"'; ?>>
>>
>> What would that look like in CF?
>
> I'd use the current row of the recordset instead of setting another toggle
> variable in a data table:
>
> <tr class="#IIF(rs.CurrentRow MOD 2, DE('odd'), DE('even'))#">
>
> --
> Tom Muck, Adobe Community Expert
> Dreamweaver Extensions/Articles -- http://www.tom-muck.com/
> Cartweaver Development Team - http://www.cartweaver.com/
> Extending Knowledge Daily - http://www.communitymx.com/
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9sptl$t2g$1@forums.macromedia.com...
> There is no recordset. It's a static page in a curiously CF site (all to
> only use cfincludes) that I have been asked to 'fix'. So - would it be -
>
> <tr class="#IIF(toggle/mod2, DE('odd'), DE('even'))#">#toggle = !toggle#

Ah, you said "data table", which led me to believe there was data in it. :-)

No, it would be:

Initialize the toggle:

<cfset toggle = 0>

Inside the loop, increment it:

<cfset toggle = toggle + 1>

Then in the tag:

<tr class="#IIF(toggle MOD 2, DE('odd'), DE('even'))#">

Tom


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

There is no loop. It's a static data table. I need it all to be self
contained in a single statement.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
news:f9strn$46a$1@forums.macromedia.com...
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:f9sptl$t2g$1@forums.macromedia.com...
>> There is no recordset. It's a static page in a curiously CF site (all to
>> only use cfincludes) that I have been asked to 'fix'. So - would it be -
>>
>> <tr class="#IIF(toggle/mod2, DE('odd'), DE('even'))#">#toggle = !toggle#
>
> Ah, you said "data table", which led me to believe there was data in it.
> :-)
>
> No, it would be:
>
> Initialize the toggle:
>
> <cfset toggle = 0>
>
> Inside the loop, increment it:
>
> <cfset toggle = toggle + 1>
>
> Then in the tag:
>
> <tr class="#IIF(toggle MOD 2, DE('odd'), DE('even'))#">
>
> Tom
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

.oO(Murray *ACE*)

>I just don't have the time or energy to manually add classes to hundreds of
>rows of existing tabular content on tens of pages - do you?

Yes, I would have the time, but there are much better and more pleasing
ways to spend it. ;-D

But I've never talked about adding those classes by hand. There should
be a way to automate it ... OK, it might require some thinking time ...

Hmm, it should be possible with regular expressions - you can match the
current and the following element, the replacement string would contain
the current element with the class addition and the unchanged following
element ... could work ... just thinking loudly ...

Micha

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

LATEST
> Hmm, it should be possible with regular expressions - you can match the
> current and the following element, the replacement string would contain
> the current element with the class addition and the unchanged following
> element ... could work ... just thinking loudly ...

Find:
<tr([^>]*?)>([\s\S]*?)<\/tr>(\s*?)<tr([^>]*?)>([\s\S]*?)<\/tr>
Replace:
<tr$1 class="even">$2</tr>$3<tr$4 class="odd">$5</tr>

Should work.

Tom


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

Preferably just the way I showed in my original PHP snippet.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9su9i$4jp$1@forums.macromedia.com...
> There is no loop. It's a static data table. I need it all to be self
> contained in a single statement.
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
> news:f9strn$46a$1@forums.macromedia.com...
>>
>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>> news:f9sptl$t2g$1@forums.macromedia.com...
>>> There is no recordset. It's a static page in a curiously CF site (all
>>> to only use cfincludes) that I have been asked to 'fix'. So - would it
>>> be -
>>>
>>> <tr class="#IIF(toggle/mod2, DE('odd'), DE('even'))#">#toggle = !toggle#
>>
>> Ah, you said "data table", which led me to believe there was data in it.
>> :-)
>>
>> No, it would be:
>>
>> Initialize the toggle:
>>
>> <cfset toggle = 0>
>>
>> Inside the loop, increment it:
>>
>> <cfset toggle = toggle + 1>
>>
>> Then in the tag:
>>
>> <tr class="#IIF(toggle MOD 2, DE('odd'), DE('even'))#">
>>
>> Tom
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

If it is a static table then the PHP code won't do anything either. A toggle
only works on a dynamic table where a loop is involved.

Tom


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9suis$4vp$1@forums.macromedia.com...
> Preferably just the way I showed in my original PHP snippet.
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:f9su9i$4jp$1@forums.macromedia.com...
>> There is no loop. It's a static data table. I need it all to be self
>> contained in a single statement.
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
>> news:f9strn$46a$1@forums.macromedia.com...
>>>
>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>> news:f9sptl$t2g$1@forums.macromedia.com...
>>>> There is no recordset. It's a static page in a curiously CF site (all
>>>> to only use cfincludes) that I have been asked to 'fix'. So - would it
>>>> be -
>>>>
>>>> <tr class="#IIF(toggle/mod2, DE('odd'), DE('even'))#">#toggle =
>>>> !toggle#
>>>
>>> Ah, you said "data table", which led me to believe there was data in it.
>>> :-)
>>>
>>> No, it would be:
>>>
>>> Initialize the toggle:
>>>
>>> <cfset toggle = 0>
>>>
>>> Inside the loop, increment it:
>>>
>>> <cfset toggle = toggle + 1>
>>>
>>> Then in the tag:
>>>
>>> <tr class="#IIF(toggle MOD 2, DE('odd'), DE('even'))#">
>>>
>>> Tom
>>>
>>
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

The heck you say.

I've done this many times in PHP -

$toggle=!$toggle; echo($toggle?"odd":"even");

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
news:f9t51p$c9p$1@forums.macromedia.com...
> If it is a static table then the PHP code won't do anything either. A
> toggle only works on a dynamic table where a loop is involved.
>
> Tom
>
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:f9suis$4vp$1@forums.macromedia.com...
>> Preferably just the way I showed in my original PHP snippet.
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>> news:f9su9i$4jp$1@forums.macromedia.com...
>>> There is no loop. It's a static data table. I need it all to be self
>>> contained in a single statement.
>>>
>>> --
>>> Murray --- ICQ 71997575
>>> Adobe Community Expert
>>> (If you *MUST* email me, don't LAUGH when you do so!)
>>> ==================
>>> http://www.dreamweavermx-templates.com - Template Triage!
>>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>>> ==================
>>>
>>>
>>> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
>>> news:f9strn$46a$1@forums.macromedia.com...
>>>>
>>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>>> news:f9sptl$t2g$1@forums.macromedia.com...
>>>>> There is no recordset. It's a static page in a curiously CF site (all
>>>>> to only use cfincludes) that I have been asked to 'fix'. So - would
>>>>> it be -
>>>>>
>>>>> <tr class="#IIF(toggle/mod2, DE('odd'), DE('even'))#">#toggle =
>>>>> !toggle#
>>>>
>>>> Ah, you said "data table", which led me to believe there was data in
>>>> it. :-)
>>>>
>>>> No, it would be:
>>>>
>>>> Initialize the toggle:
>>>>
>>>> <cfset toggle = 0>
>>>>
>>>> Inside the loop, increment it:
>>>>
>>>> <cfset toggle = toggle + 1>
>>>>
>>>> Then in the tag:
>>>>
>>>> <tr class="#IIF(toggle MOD 2, DE('odd'), DE('even'))#">
>>>>
>>>> Tom
>>>>
>>>
>>>
>>
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9t5tu$d86$1@forums.macromedia.com...
> The heck you say.
>
> I've done this many times in PHP -
>
> $toggle=!$toggle; echo($toggle?"odd":"even");

The heck you say. That does absolutely nothing unless it's in a loop...or
unless you copy/paste into every row. If you are doing that, then this code
is identical:

class="odd"
class="even"

Tom


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

I am doing a 'table-wide' find and replace, finding <tr> and replacing with
<tr<?php ... ?>>.

It works fine in PHP. I just need to know how to do the same in CF.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
news:f9t6ea$drl$1@forums.macromedia.com...
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:f9t5tu$d86$1@forums.macromedia.com...
>> The heck you say.
>>
>> I've done this many times in PHP -
>>
>> $toggle=!$toggle; echo($toggle?"odd":"even");
>
> The heck you say. That does absolutely nothing unless it's in a loop...or
> unless you copy/paste into every row. If you are doing that, then this
> code is identical:
>
> class="odd"
> class="even"
>
> Tom
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

That's silly. Putting dynamic code in a static table?

Sorry. In that case the code is as I said:

<cfset toggle = toggle + 1><tr class="#IIF(toggle MOD 2, DE('odd'),
DE('even'))#">

Tom


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9t6id$dvg$1@forums.macromedia.com...
>I am doing a 'table-wide' find and replace, finding <tr> and replacing with
><tr<?php ... ?>>.
>
> It works fine in PHP. I just need to know how to do the same in CF.
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
> news:f9t6ea$drl$1@forums.macromedia.com...
>>
>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>> news:f9t5tu$d86$1@forums.macromedia.com...
>>> The heck you say.
>>>
>>> I've done this many times in PHP -
>>>
>>> $toggle=!$toggle; echo($toggle?"odd":"even");
>>
>> The heck you say. That does absolutely nothing unless it's in a loop...or
>> unless you copy/paste into every row. If you are doing that, then this
>> code is identical:
>>
>> class="odd"
>> class="even"
>>
>> Tom
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

Does this table have hundreds or thousands of rows? Much easier to apply
class="even" to every other row wtih ctrl>y. It would take about two minutes
to do a few hundred rows.

Tom

"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9t6id$dvg$1@forums.macromedia.com...
>I am doing a 'table-wide' find and replace, finding <tr> and replacing with
><tr<?php ... ?>>.
>
> It works fine in PHP. I just need to know how to do the same in CF.
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
> news:f9t6ea$drl$1@forums.macromedia.com...
>>
>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>> news:f9t5tu$d86$1@forums.macromedia.com...
>>> The heck you say.
>>>
>>> I've done this many times in PHP -
>>>
>>> $toggle=!$toggle; echo($toggle?"odd":"even");
>>
>> The heck you say. That does absolutely nothing unless it's in a loop...or
>> unless you copy/paste into every row. If you are doing that, then this
>> code is identical:
>>
>> class="odd"
>> class="even"
>>
>> Tom
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

50 or so pages, each with 200 - 1000 rows? I don't think so.

But this will do the trick, I believe.

<cfset toggle = toggle + 1><tr class="#IIF(toggle MOD 2, DE('odd'),
DE('even'))#">


--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
news:f9t732$ego$1@forums.macromedia.com...
> Does this table have hundreds or thousands of rows? Much easier to apply
> class="even" to every other row wtih ctrl>y. It would take about two
> minutes to do a few hundred rows.
>
> Tom
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:f9t6id$dvg$1@forums.macromedia.com...
>>I am doing a 'table-wide' find and replace, finding <tr> and replacing
>>with <tr<?php ... ?>>.
>>
>> It works fine in PHP. I just need to know how to do the same in CF.
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
>> news:f9t6ea$drl$1@forums.macromedia.com...
>>>
>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>> news:f9t5tu$d86$1@forums.macromedia.com...
>>>> The heck you say.
>>>>
>>>> I've done this many times in PHP -
>>>>
>>>> $toggle=!$toggle; echo($toggle?"odd":"even");
>>>
>>> The heck you say. That does absolutely nothing unless it's in a
>>> loop...or unless you copy/paste into every row. If you are doing that,
>>> then this code is identical:
>>>
>>> class="odd"
>>> class="even"
>>>
>>> Tom
>>>
>>
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

A little javascript would do it too:

<script>
function colorTable() {
var tableRows =
document.getElementById('mytable').getElementsByTagName('tr');
for(var i=0; i<tableRows.length; i++) {
tableRows .className = (i%2==0) ? 'even':'odd';
}
}
</script>

onload="colorTable()"

Tom

"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:f9t829$fl7$1@forums.macromedia.com...
> 50 or so pages, each with 200 - 1000 rows? I don't think so.
>
> But this will do the trick, I believe.
>
> <cfset toggle = toggle + 1><tr class="#IIF(toggle MOD 2, DE('odd'),
> DE('even'))#">
>
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
> news:f9t732$ego$1@forums.macromedia.com...
>> Does this table have hundreds or thousands of rows? Much easier to apply
>> class="even" to every other row wtih ctrl>y. It would take about two
>> minutes to do a few hundred rows.
>>
>> Tom
>>
>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>> news:f9t6id$dvg$1@forums.macromedia.com...
>>>I am doing a 'table-wide' find and replace, finding <tr> and replacing
>>>with <tr<?php ... ?>>.
>>>
>>> It works fine in PHP. I just need to know how to do the same in CF.
>>>
>>> --
>>> Murray --- ICQ 71997575
>>> Adobe Community Expert
>>> (If you *MUST* email me, don't LAUGH when you do so!)
>>> ==================
>>> http://www.dreamweavermx-templates.com - Template Triage!
>>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>>> ==================
>>>
>>>
>>> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
>>> news:f9t6ea$drl$1@forums.macromedia.com...
>>>>
>>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>>> news:f9t5tu$d86$1@forums.macromedia.com...
>>>>> The heck you say.
>>>>>
>>>>> I've done this many times in PHP -
>>>>>
>>>>> $toggle=!$toggle; echo($toggle?"odd":"even");
>>>>
>>>> The heck you say. That does absolutely nothing unless it's in a
>>>> loop...or unless you copy/paste into every row. If you are doing that,
>>>> then this code is identical:
>>>>
>>>> class="odd"
>>>> class="even"
>>>>
>>>> Tom
>>>>
>>>
>>>
>>
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2007 Aug 14, 2007

Copy link to clipboard

Copied

That's cool. I may do that, then! Thankee....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
news:f9t8d5$g20$1@forums.macromedia.com...
>A little javascript would do it too:
>
> <script>
> function colorTable() {
> var tableRows =
> document.getElementById('mytable').getElementsByTagName('tr');
> for(var i=0; i<tableRows.length; i++) {
> tableRows .className = (i%2==0) ? 'even':'odd';
> }
> }
> </script>
>
> onload="colorTable()"
>
> Tom
>
> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
> news:f9t829$fl7$1@forums.macromedia.com...
>> 50 or so pages, each with 200 - 1000 rows? I don't think so.
>>
>> But this will do the trick, I believe.
>>
>> <cfset toggle = toggle + 1><tr class="#IIF(toggle MOD 2, DE('odd'),
>> DE('even'))#">
>>
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do so!)
>> ==================
>> http://www.dreamweavermx-templates.com - Template Triage!
>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>> ==================
>>
>>
>> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
>> news:f9t732$ego$1@forums.macromedia.com...
>>> Does this table have hundreds or thousands of rows? Much easier to apply
>>> class="even" to every other row wtih ctrl>y. It would take about two
>>> minutes to do a few hundred rows.
>>>
>>> Tom
>>>
>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>> news:f9t6id$dvg$1@forums.macromedia.com...
>>>>I am doing a 'table-wide' find and replace, finding <tr> and replacing
>>>>with <tr<?php ... ?>>.
>>>>
>>>> It works fine in PHP. I just need to know how to do the same in CF.
>>>>
>>>> --
>>>> Murray --- ICQ 71997575
>>>> Adobe Community Expert
>>>> (If you *MUST* email me, don't LAUGH when you do so!)
>>>> ==================
>>>> http://www.dreamweavermx-templates.com - Template Triage!
>>>> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
>>>> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
>>>> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
>>>> ==================
>>>>
>>>>
>>>> "Tom Muck" <tommuck@NO-SPAM-hotmail.com> wrote in message
>>>> news:f9t6ea$drl$1@forums.macromedia.com...
>>>>>
>>>>> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
>>>>> news:f9t5tu$d86$1@forums.macromedia.com...
>>>>>> The heck you say.
>>>>>>
>>>>>> I've done this many times in PHP -
>>>>>>
>>>>>> $toggle=!$toggle; echo($toggle?"odd":"even");
>>>>>
>>>>> The heck you say. That does absolutely nothing unless it's in a
>>>>> loop...or unless you copy/paste into every row. If you are doing that,
>>>>> then this code is identical:
>>>>>
>>>>> class="odd"
>>>>> class="even"
>>>>>
>>>>> Tom
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines