0

下面的代码不起作用,因为我在彼此内部调用 build-markup 两次并使用相同的全局模板变量。有什么方法可以更正构建标记以便我可以传递本地模板变量?

Template: {<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Free PHP Gallery - web-templates.nu</title>
<meta name="Description" content="This is a template of a free php gallery." />
<meta name="Keywords" content="template, gallery, php, free" />
<link rel="stylesheet" href="gallery/style_gallery.php" type="text/css" media="screen" />
</head>

<body>

<!-- ##### Include your gallery class and gallery between the body-tags ##### 
#
# To add images to your gallery, change the ADD-IMAGES.PHP
# To change the look of the gallery, change the SETTINGS.PHP
#
##### -->

<div class="gallery">
<%do %galleryview.cgi "" %>
</div>

<!-- ##### That's it, just copy and paste the line above ##### -->

</body>
</html>}

print build-markup Template
4

1 回答 1

1

'bind-markup是一个令人耳目一新的简短函数。将它复制到您自己的脚本并添加一个允许您传递目标上下文的参数会相对容易:

build-markup: func [
    ...
    /with scope [word! object!]
]

然后在'eval评估加载代码的函数中,将块更改try [do val]try [do bind load/all val any [:scope system/words]]. 我相信应该这样做。

于 2012-12-03T19:44:25.690 回答