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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 26th, 2004, 09:21 AM
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
Replacing class styles

I'm using the script below to parse out a variable and replace the class tag with class="link12" whenever there is an <a href tage which works fine. However, our users copy and paste from MS Word into our editor which grabs the extraneous word styles. So now my code changes all the word class tag too which I don't want. For instance if theres a tag <p class="MsoBodyText"> it changes it to <p class="link12"> which I don't want. I know it's a small change but I'm not sure what to do. Normally I would just strip the word styles out completely but I've been told to leave them in. Any help would be appreciated.

<cfset aLinks = ListToArray(ReplaceNoCase(stObject.content1,"<a","#Chr(167)#<a","ALL"),Chr(167))>
<cfloop index="a" from="1" to="#ArrayLen(aLinks)#">
<cfif not FindNoCase("class=#chr(34)#",aLinks[a],1)>
<cfset aLinks[a] = ReplaceNoCase(aLinks[a], "<a", "<a class=#chr(34)#link12#chr(34)#")>
<cfelseif 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, "link12", "All")>
</cfif>
</cfloop>
<!---<cfset temp = ArrayDeleteAt(aLinks, 1)>--->
<cfset stObject.content1 = ArrayToList(aLinks, chr(10))>

Reply With Quote
  #2  
Old August 26th, 2004, 09:36 AM
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
Is there anything to differentiate the Word styles from the other types of styles? If there isn't, I don't think what you are asking for is possible.
__________________
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
  #3  
Old August 26th, 2004, 09:49 AM
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
Quote:
Originally Posted by kiteless
Is there anything to differentiate the Word styles from the other types of styles? If there isn't, I don't think what you are asking for is possible.


Unfortunately I don't think so. At this point with this job I'm about the throw in the towel.

Reply With Quote
  #4  
Old August 26th, 2004, 10:09 AM
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
Sometimes part of being a good developer is the ability to clearly explain why something that someone is asking for is simply not feasable. Technically, anything is possible, but the cost/benefit ratio must be considered and sometimes the payoff just isn't worth the effort, not matter how much the requestor wants it. I think your best option is to try to get this message across.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Replacing class styles


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