Link to home
Start Free TrialLog in
Avatar of Qsorb
QsorbFlag for United States of America

asked on

URGENT request to remove unwanted line feed after expansion of variable

<cfquery name="GetStory" datasource="qNEWS">
 select top 1 *
 from bnews
 where ID = '#ID#'
 and online = 1
 order by id desc
</cfquery>

<cfoutput query="GetStory">

<cfset defaultbreakpos = len(GetStory.Story_body)*.6>
<cfif NOT mid(GetStory.story_body, defaultbreakpos, 1) is " ">
  <cfset temppos = refindnocase("[\s]", reverse(left(GetStory.story_body, defaultbreakpos)))>
  <cfset breakpos = defaultbreakpos-temppos+1>
<cfelse>
  <cfset breakpos = defaultbreakpos>
</cfif>
<cfset toptext = left(GetStory.story_body, breakpos)>

#ParagraphFormat(toptext)# <a href="#GetStory.URL_LINK#" target="_blank">Read more</a>

</cfoutput>

Open in new window


The "Read more" line needs to be on the same line as the last line of the story_body. As it is now, it's always moved down one line.

I don't want to remove all the line feeds in the story as they're needed. I only want to remove the last line break, if possible, or do this a different way.

Show me how to do this with my code snippet.
Avatar of Coast Line
Coast Line
Flag of Canada image

remove paragraphformat and it will display just rightafter its ending
ASKER CERTIFIED SOLUTION
Avatar of dgrafx
dgrafx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Qsorb

ASKER

myselfrandhawa:  Of course I need the ParagraphFormat so that won't work.

Dgrafx:  That's exactly what I waned. Thanks!