Rebol Tutorial
Rebol Tutorial

Reputation: 2754

Any way to correct Rebol build-markup function using bind or whatever?

This code below doesn't work because I call build-markup two times one inside each other and using the same Global Template variable. Any way to correct build-markup so that I can pass local Template variable ?

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

Upvotes: 0

Views: 106

Answers (1)

rgchris
rgchris

Reputation: 3718

'bind-markup is a refreshingly short function. It'd be relatively easy to copy it to your own script and add a parameter that would allow you to pass the target context through:

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

Then within the 'eval function where the loaded code is evaluated, change the block try [do val] to try [do bind load/all val any [:scope system/words]]. I believe that should do it.

Upvotes: 1

Related Questions