在我们正在进行的重构练习中,我们必须更改所选网站的页面模板.大多数页面都已本地化,并且通过下面的代码更新了页面模板,但是对于少数页面,我们收到以下错误:
XML validation error. Reason: The element 'Metadata' in namespace 'uuid:940d95aa-fcce-481c-8de5-c61d06c74f46' has invalid child element 'description' in namespace 'uuid:940d95aa-fcce-481c-8de5-c61d06c74f46'.
List of possible elements expected: 'TitleSEO, KeywordsSEO, DescriptionSEO, omniture' in namespace 'uuid:940d95aa-fcce-481c-8de5-c61d06c74f46'.
Run Code Online (Sandbox Code Playgroud)
我们的元数据模式中没有描述字段,TitleSEO,KeywordsSEO,DescriptionSEO,omniture都是可由代码更改的可选字段.
try
{
pData = client.Read(page.Attribute("ID").Value, null) as PageData;
//Localize Page
if (!(bool)pData.BluePrintInfo.IsLocalized)
{
client.Localize(pData.Id, new ReadOptions());
if (dTemplateIDs.ContainsKey(pData.PageTemplate.IdRef.ToString()))
{
pData.IsPageTemplateInherited = false;
pData.PageTemplate.IdRef = dTemplateIDs[pData.PageTemplate.IdRef];
client.Update(pData, new ReadOptions());
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error Inner " + ex.Message);
}
Run Code Online (Sandbox Code Playgroud) 我需要TemplateBeginRepeat在需要输出自定义标签的位置创建2个循环
<!-- TemplateBeginRepeat name="customtag" -->
${RenderComponentPresentation(Field, rendercustomtagstarttemplate)}
<!-- TemplateEndRepeat -->
Run Code Online (Sandbox Code Playgroud)
输出一些HTML
<!-- TemplateBeginRepeat name="customtag" -->
${RenderComponentPresentation(Field, rendercustomtagclosetemplate)}
<!-- TemplateEndRepeat -->
Run Code Online (Sandbox Code Playgroud)
由于第二个循环关闭由第一个循环呈现的自定义标记,因此第二个循环应以相反的顺序运行.(因为标签需要以相反的顺序关闭).如何使用TemplateBeginRepeat以相反的顺序运行第二个循环?