<?!=在Google Apps脚本中是什么意思? [英] What does <?!= mean in Google Apps Script?

查看:57
本文介绍了<?!=在Google Apps脚本中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在类似的页面上 https://github.com/google/google-apps-script-samples/blob/master/simple_tasks/Page.html 我看到括号内的代码如下所示:

On pages like https://github.com/google/google-apps-script-samples/blob/master/simple_tasks/Page.html I see code bracketed as shown:

<?!= HtmlService.createHtmlOutputFromFile('JavaScript').getContent(); ?>

<?!= ?> 序列是什么意思?它是否转换为对服务器上的Google Apps脚本/Javascript(在这种情况下为全局HtmlService对象)的直接调用?使用PHP时有点像<?php ?

What does <?!= to ?> sequence mean? Does it translate to a direct call to Google Apps Script/Javascript on the server, in this case the global HtmlService object? Sort of like <?php when using PHP?

使用Goog进行搜索似乎是不可能的.我尝试了各种引用/转义技术,但没有成功.

This appears to be impossible to search for using the Goog. I tried various quoting/escaping techniques without success.

推荐答案

这些被称为 HtmlTemplate 方法-service"rel =" nofollow> HtmlService ,它们将在服务器端进行评估,在将内容返回给客户端之前,您可以调用其他.gs文件中定义的函数,引用全局变量,几乎任何您可以在.gs文件中运行的代码.

Those are called scriptlets, and as you mentioned, just like in PHP or other templating language, in Google Apps Script you can mix code and HTML when using HtmlTemplate method in the HtmlService, they will be evaluated at the server side, before the content is returned to the client, you can call functions defined in other .gs files, reference global variables, almost any code you can run inside a .gs file.

官方开发者网站中对它们进行了很好的记录.,但简历中提供了三种类型的电子小报:

They are pretty well documented in the Official Developers Website, but in resume there are three types of scriplets:

  • 标准脚本 <代码>< ;?...?> :代码执行时没有显式输出.
  • 打印脚本 <?= ...?> :代码运行并使用上下文转义输出结果.
  • 强制打印脚本 <?!= ...?> :代码运行并输出结果,但避免上下文转义.
  • Standard scriptlets <? ... ?>: The code is executed without explicit output.
  • Printing scriptlets <?= ... ?>: The code runs and outputs the results using contextual escaping.
  • Force-printing scriptlets <?!= ... ?>: The code runs and outputs the results, but avoiding contextual escaping.

文档中有简单示例使用模板HTML来分隔HTML,CSS和JavaScript.

The documentation has a simple example of how to separate HTML, CSS and JavaScript using Templated HTML.

这篇关于&lt;?!=在Google Apps脚本中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆