In HTML,
these two chars work the same

    "    '     dbl single
if you start a string with a single quote, it continues until the next single quote if you start a string with a dbl quote, it continues until the next dbl quote
 so  var = 'a phrase containing a " char is kept intact'
         without escaping or the  "  entity

so use the double quote for Rev and the single quote for HTML code

-A-  Without using merge() function
get empty
get IT & "<a href='http://"; & fld link && "target='_blank' > & fld link & "</a>"
get IT & "<br/></br/>"
put IT after tData

---- the output is valid code and a clickable link
<a href='http://google.com' target='_blank' >google.com</a><br/><br/>

-B-  using the merge function
put merge( \
"<a href='http://[[fld link]]' target='_blank' >[[fld link]]</ a><br/><br/> " \
      ) after tData

---- the output is valid code and a clickable link
<a href='http://google.com' target='_blank' >google.com</a><br/><br/>


Jim Ault
Las Vegas


On Aug 25, 2010, at 1:44 AM, Richard Gaskin wrote:

William de Smet wrote:

It's been a while since my last question but working hard on some apps.
For my daily job I needed a quick app to create a HTML file. In the
app I have some fields and in one of them I put a URL (just
www.domainname.com).
In some hidden fields I put the needed HTML and the all come together
when I save the file.
All works fine but when I look at the sourcecode in IE8 or Safari the
HTML isn't completely correct.
In a link it misses the quotes (") at the beginning or the end of the URL.

What I do is this:
put "<a href="& "http://"; & fld "link" & " & target="& _blank &" >"
& fld "link" &"</a>" &  "<"&"br/"&">"  &  "<"&"br/"&">" after tData

You've discovered why I hate concatenating HTML in xTalks. ;)

I've found it far less tedious to just write the HMTL as I want it in the final output and use the merge function to assemble the dynamic parts.

For example, you could have this in a field named "template":

<a href="http://[[fld "link"]]" target="_blank ">[[fld "link"]]</ a><br/><br/>

...and then just use this to get the assembled output:

put merge(fld "template") into tData

Check out the merge function in the RevTalk dictionary. It's a life- saver for tasks like this (and a good many others).

--




_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to