SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 12th, 2004, 01:53 PM
kgraber kgraber is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 37 kgraber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 41 m 7 sec
Reputation Power: 5
Array Problem I think

Ok guys here's the problem. I have the code below that basically changes an href tag to include a class="link11" or change a previous class to class="link11" and this works great on one page. However on another page with multiple links it will add the class="link11" to all but the last link. The last link will have no class. I have no idea why it's working on one page and not on another.

<cfset aLinks = ListToArray(ReplaceNoCase(webpage,"<a","#Chr(167)#<a","ALL"),Chr(167))>
<cfloop index="a" from="1" to="#ArrayLen(aLinks)#">
<cfif FindNoCase("class=#chr(34)#",aLinks[a],1)>
<cfset class = Mid(aLinks[a], FindNoCase("class=#chr(34)#",aLinks[a],1)+7, Len(aLinks[a]))>
<cfset class = Left(class, Find(chr(34), class, 1)-1)>
<cfset aLinks[a] = ReplaceNoCase(aLinks[a], class, "link11", "All")>
<cfelse>
<cfset aLinks[a] = ReplaceNoCase(aLinks[a], "<a", "<a class=#chr(34)#link11#chr(34)#")>
</cfif>
</cfloop>
<cfset temp = ArrayDeleteAt(aLinks, 1)>
<cfset webpage = ArrayToList(aLinks, chr(10))>

Reply With Quote
  #2  
Old August 12th, 2004, 03:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Do a cfdump of #aLinks#. Are all the links in the array? If not, then the problem is that the last link isn't making it into the array at all. This is probably what is happening. It may mean you need to modify the code that is creating the array.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Array Problem I think


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway