【问题标题】:silverstripe shortcode return dynamic templatesilverstripe 简码返回动态模板
【发布时间】:2013-05-07 16:28:49
【问题描述】:

我按照此说明在页面的内容字段 (HTMLEditor) 中包含变量 - 以便可以将变量替换为其他内容: http://www.balbuss.com/mini-introduction-to-shortcodes/

我想显示 $Content 中的数据对象列表。

遗憾的是,指令中的 DummyHandler 是静态的。所以我无法访问其中的控制器,让他做某事(生成列表。)

是否有在静态函数中访问控制器的解决方案,或者是否有另一种更好的方法可以将变量放入 $Content 中。

谢谢, 弗洛里安

【问题讨论】:

    标签: content-management-system silverstripe


    【解决方案1】:

    Controller::curr() 可能是您所追求的? 与 Controller::hasCurr() 一起使用,因为在使用 Controller::curr() 时没有控制器意味着错误

    https://github.com/silverstripe/sapphire/blob/3.0/control/Controller.php#L384

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-22
      • 1970-01-01
      相关资源
      最近更新 更多