2009-12-10 2 views
0

빌드 마크 업을 서로 내부에서 두 번 호출하고 동일한 전역 템플릿 변수를 사용하기 때문에이 코드는 작동하지 않습니다. 로컬 템플릿 변수를 전달할 수 있도록 빌드 마크 업을 수정하는 방법은 무엇입니까?바인드 등을 사용하여 Rebol 빌드 마크 업 기능을 수정할 수있는 방법은 무엇입니까?

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 
+0

왜 템플릿이라는 단어를 통해 두 템플릿을 모두 참조해야합니까? 다른 이름을 사용하여 무엇을 멈추게합니까? –

+0

그런데 왜 빌드 마크 업 기능에 문제가있는 것처럼 질문을 작성 했습니까? 그것은 그것이하기로되어있는 일을합니다. –

+0

이것이 캡슐화의 의미입니다. 그래서 Local Var Context와 FUTURE 네임 스페이스가 Rebol 3 no에서 고안된 이유입니다. –

답변

1

'bind-markup은 상쾌한 짧은 기능입니다. 자신의 스크립트에 복사 상대적으로 쉽게하고 당신을 통해 타겟 문맥을 통과 할 수 있도록 해주는 매개 변수를 추가 할 것 : 그런 다음로드 된 코드가 평가하는 'eval 함수 내에서 블록을 변경

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

try [do val] ~ try [do bind load/all val any [:scope system/words]]. 나는 그것을해야한다고 믿습니다.