Google Apps Script HtmlService template and URLs -


i giving first shot @ html templating google appsscript , have had pretty decent experience far. problem urls not being processed (replaced "false")

my code.gs looks :

var section = htmlservice   .createtemplatefromfile('section')   .evaluate()   .setsandboxmode(htmlservice.sandboxmode.iframe);  logger.log(section.getcontent()); 

and html (section.html) :

<?  var section = [   {title: "foo",    paragraph: "bar",    url: "https://www.youtube.com/v=foobar"},   {title: "foo2",    paragraph: "bar2",    url: "https://www.youtube.com/v=foobar2"}];  (var x in section) { ?>  <h1><?= section[x].title ?> </h1> <p><?= section[x].paragraph ?> </p> <a href="<?= section[x].url ?>"> link </a>  <? } ?> 

and result of (the log) :

<h1>foo </h1> <p>bar</p> <a href="false"> link </a>  <h1>foo2 </h1> <p>bar2</p> <a href="false"> link </a> 

the same occurs img' urls i'm guessing there security notion here might overlooking... have idea how fix it?

thanks!

nevermind...

the issue improper force-printing syntax...

so if happens in future, templating tags should :

<?!= .... => 

and not

<? .... ?> 

nor (that mistake) :

<?=! .... ?> 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -