The task is to display the pictures in a row with horizontal formatting with captions. Example

There is a range of A1-A10 (images) and B1-B10 (signatures) to them

Now I have such a code that simply displays images from a range.

Thank!

.gs

var range = sheet.getRange("A1:A10"); var urls = range.getValues(); var range = sheet.getRange("B1:B10"); var strn = range.getValues(); var template = HtmlService.createTemplateFromFile('images'); template.urls = urls; template.strn = strn; return template.evaluate(); 

images

  <!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <table> <? for(var i=0; i < urls.length; i++ ) { ?> <tr> <? for(var j=0; j < urls[i].length; j++) { ?> <td> <img src="<?=urls[i][j] ?>" /> </td> <?}?> </tr> <? } ?> </table> </body> </html> 
  • var in php ? <? for(var j <? for(var j - Raz Galstyan
  • Do you intend to use any framework or library to simplify the code? It may be worthwhile to change the approach to the organization of client code as here ru.stackoverflow.com/questions/681069/… - oshliaer
  • Maybe! I will briefly describe what I give to the client in general 1) what you did, that is, the range of the text with the highlighted line 2) below them are the pictures (miniatures) that relate to the text.3) general pictures on this topic. I still have a problem with paragraph 2 ! Now I have such a conclusion: joxi.ru/KAgKqYec4JEx0A - Alex

1 answer 1

Well, who's stopping you from doing that?

 <div class="thumb"> <?php for($i=0; i < $urls.length; $i++ ) { ?> <?php for($j=0; j < $urls[$i].length; $j++) { ?> <figure> <img src="<?=$urls[$i][$j] ?>" /> <figcaption>Text1</figcaption> </figure> <?php } ?> <?php } ?> </div> 
  • Thanks you ! I'm a beginner - this will work in a google-apps-script for the first time I just come across <? php? - Alex
  • @AlexanderBaskakov if your code works then it will. look if you write something - Raz Galstyan
  • @ gives an error, I will try to figure it out myself. Thank you - Alex
  • @AlexanderBaskakov write a mistake - Raz Galstyan
  • writes no character in line; . but I think that I am not correctly inserting the classes from the jsfiddle.net/47rm8kwc example. Tell me where to look at the elementary example on this topic? - Alex