我正在文章中描述的Sitecore 7中实现动态占位符
它工作正常,我可以添加相同的渲染到布局,渲染将进入相应的动态占位符.但是,当我单击将渲染添加到动态占位符时,不使用占位符设置.
我期待的是提示可以放置在动态占位符上的允许渲染.而是呈现渲染/布局树以手动选择渲染 - 使内容编辑器能够将不允许的渲染添加到占位符.
我已经调试了代码,并且正在为动态占位符找到正确的占位符设置项,并且正在检索允许的渲染列表,但是尽管在args中设置了列表,但是没有为用户显示.见下面的代码.
public class GetDynamicKeyAllowedRenderings : GetAllowedRenderings
{
//string that ends in a GUID
public const string DynamicKeyRegex = @"(.+){[\d\w]{8}\-([\d\w]{4}\-){3}[\d\w]{12}}";
public new void Process(GetPlaceholderRenderingsArgs args)
{
Assert.IsNotNull(args, "args");
// get the placeholder key
string placeholderKey = args.PlaceholderKey;
var regex = new Regex(DynamicKeyRegex);
Match match = regex.Match(placeholderKey);
// if the placeholder key text followed by a Guid
if (match.Success && match.Groups.Count > 0)
{
// Is a dynamic placeholder
placeholderKey = match.Groups[1].Value;
}
else …Run Code Online (Sandbox Code Playgroud) 如何在模板的DataSource中编写查询以生成项目的路径?
如果我在DataSource字段中编写查询并且页面使用模板,则数据源值将是项目的路径作为动态数据源,如屏幕截图.
