【发布时间】:2017-10-18 06:40:41
【问题描述】:
默认情况下,OctoberCMS 插件组件会渲染部分 default.htm。是否可以覆盖将呈现的部分?比如……
插件文件结构
├── components
│ ├── example
│ │ ├── default.htm
│ │ ├── other_partial.htm
│ ├── Example.php
├── ...
├── Plugin.php
例子.php
class Example extends ComponentBase {
public function onRun() {
// change the rendered partial, such that other_partial.htm
// will be rendered instead of default.htm
$this->setRenderedPartial('other_partial')
}
}
我知道可以从default.htm 内部渲染other_partial,但在我的情况下,我试图保持default.htm 不变,并将其他部分渲染为默认值。
【问题讨论】:
标签: php octobercms octobercms-plugins