|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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))>
__________________
http://www.dieselstudios.com - http://www.trackmycash.com - http://www.hamptonsoftrentdale.com |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Array Problem I think |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|