Create HTML file from rev app

Richard Gaskin ambassador at fourthworld.com
Wed Aug 25 04:44:51 EDT 2010


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).

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list