William, Merge is king!
Another cool command is "format" which is like C printf() function. It can be used like this: put format("<html><head><title>my title</title></head><body><p><a href=\"%s\">%s</a></p></body></html>", fld "link", fld "link") into tHTML keep notice that you can use " inside a quoted format string if you escape them like \" You can use %s place holders where you want to insert your data that is passed in order as arguments for the format function. In that example I use two %s placeholders which are replaced with field "link" and field "link" again. The place holders are cool because you can use them to format, for example, suppose I am passing the value 5 to the following placeholders: %s output 5 %d output 5 %.2f output 5.00 %.3f output 5.000 %3d output 005 %4d output 0005 (there is much more to it but this is enough to show the concept) :D On Wed, Aug 25, 2010 at 5:58 AM, William de Smet <williamdes...@gmail.com>wrote: > Thanks Richard, > > That looks so much easier. I never used 'merge' before. > I will definitely use this. > > Greetings, > > William > > > > 2010/8/25 Richard Gaskin <ambassa...@fourthworld.com>: > > 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 > > _______________________________________________ > > 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 > > > _______________________________________________ > 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 > -- http://www.andregarzia.com All We Do Is Code. _______________________________________________ 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