Toolkit - Removing Line Breaks from a String

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrisb
    Mini Mivite

    • Nov 2010
    • 34

    #1

    Toolkit - Removing Line Breaks from a String

    I've got a page dedicated as a handler for AJAX, returning wanted values in JSON - yes, the page has the http_headers item assigned to it and returns a Content-Type of "application/json". Using Weiland's Toolkit, I'd like to have one response contain HTML to replace an element on the page, so I've done this:
    Code:
    <mvt:item name="toolkit" param="mvassign|url|'http://' $ g.domain:name $ '/MINICART.html'"/>
    <mvt:item name="toolkit" param="vcallurl|carthtml|g.url|get|g.session_id"/>
    <mvt:item name="toolkit" param="mvassign|carthtml|encodeentities(g.carthtml)"/>
    When I run the URL for this page through this validator, it says there's invalid characters in the member containing the HTML. I assume it's the line breaks in the string, and tried to remove them by doing this:
    Code:
    <mvt:item name="toolkit" param="mvassign|url|'http://' $ g.domain:name $ '/MINICART.html'"/>
    <mvt:item name="toolkit" param="vcallurl|carthtml|g.url|get|g.session_id"/>
    <mvt:item name="toolkit" param="mvassign|carthtml|glosub(g.carthtml,asciichar(12),'')"/>
    <mvt:item name="toolkit" param="mvassign|carthtml|glosub(g.carthtml,asciichar(15),'')"/>
    <mvt:item name="toolkit" param="mvassign|carthtml|encodeentities(g.carthtml)"/>
    But the output isn't changed at all. Is there some way to remove line breaks from a string using store morph items or MivaScript that I'm not aware about?
  • Bruce - PhosphorMedia
    Developer Partner











    • Mar 2006
    • 11256

    #2
    Re: Toolkit - Removing Line Breaks from a String

    asciichar(10) = line feed
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment

    • chrisb
      Mini Mivite

      • Nov 2010
      • 34

      #3
      Re: Toolkit - Removing Line Breaks from a String

      Thanks, Bruce... looks like I was looking at the octal equivalents on this table.

      Comment

      Working...
      X