변수에 액세스하는 데 문제가 있습니다. 여기서는 Setvariable입니다. 루프 안으로 들어가면 변수가 존재하지 않습니다. 누구든지 이에 대해 통찰력을 가지고 있습니다. 당신의 도움을 이해하십시오Dreamweaver 템플릿의 루핑 및 TemplateRepeatIndex
다음은 템플릿의 코드 섹션입니다. 기회가 생겼을 때 도와 주시겠습니까? 감사.
<!-- TemplateBeginRepeat name="Component.Fields.section" -->
@@SetVariable("columnSectionIndex", "${TemplateRepeatIndex}")@@
Inline Value @@GetVariable("columnSectionIndex")@@ Variable value can be accessed
<!-- TemplateBeginRepeat name ="Field.links" -->
Inside Loop Value @@GetVariable("columnSectionIndex")@@ //Not getting declared variable //value here. Says variable doesn’t exist in ContextVariables.
<!-- TemplateBeginRepeat name ="Field.linkimages" -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
<!-- TemplateEndRepeat -->
출력
Variable Added Successfully
Inline Value 0
Inside Loop Value Variable doesn't exist
이 도움이 될
[TemplateCallable()]
public string SetVariable(string variableName, string value)
{
//Remove the old variable and set the new variable
if (_Engine.PublishingContext.RenderContext.ContextVariables.Contains(variableName))
{
_Engine.PublishingContext.RenderContext.ContextVariables[variableName] = value;
return "Variable Modified Successfully";
}
else
{
_Engine.PublishingContext.RenderContext.ContextVariables.Add(variableName, value);
return "Variable Added Successfully";
}
}
[TemplateCallable()]
public string GetVariable(string variableName)
{
//Get the varialbe
if (_Engine.PublishingContext.RenderContext.ContextVariables.Contains(variableName))
return _Engine.PublishingContext.RenderContext.ContextVariables[variableName].ToString();
else
return "Variable doesn't exist";
}
시간 내 주셔서 감사합니다. tridiondeveloper에서 같은 코드를 사용했지만 작동하지 않았습니다. –