|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Replace Help
I need to be able to add a class tag to an <a href. I already have this which is fine. However the problem I have and am not sure how to figure out is that if the <a href already has a class tag. If it does my replace would add another class tag which wouldn't work. Any ideas?
__________________
http://www.dieselstudios.com - http://www.trackmycash.com - http://www.hamptonsoftrentdale.com |
|
#2
|
|||
|
|||
|
You could first check the string to see if it contains "class=" or "class =" and only insert the new class value if that check returns false.
__________________
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 |
|
#3
|
|||
|
|||
|
Quote:
Can you give me an example. That's what I thought but I'm not having any luck. |
|
#4
|
|||
|
|||
|
Well I'm assuming you have a regex or something that grabs you all the strings that are links (ie start with <a and end with </a>). So for each of those strings, do something like:
<cfif not findNoCase( 'class=', thisLinkString ) and not findNoCase( 'class =', thisLinkString )> ...go ahead with adding the class to the link.... </a> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Replace Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|