OctoberCMS |从组件
问题描述:
访问静态页面属性有一些方法可以将静态页面的额外字段中的值提取到某个组件中?OctoberCMS |从组件
我需要实现AJAX处理器...
我可以加载静态页面的内容,但是,我需要的是由用户设置好的属性...
我需要的代码的例子......我可以加载静态页面内容作为Partial
#noobhacks :)
public function onOpenHome()
{
$this->page['categories'] = Category::all();
return [
//'main' => $this->renderPartial('home'),
'main' => $this->renderPartial('../content/static-pages/index'),
'.home_categories' => $this->renderPartial('work_list_categories_post')
];
}
或内容:
[viewBag]
==
<main class="home_container" __color="{{ color }}">
<section class="box">
{% content '/static-pages/index.htm' %} <!-- <<<<------ -->
{{ content |raw }}
</section>
</main>
但我不IDEIA如何访问到ColorPicker的财产color
答
组件对象使用自己的姓名(或别名)可供选择。这意味着“颜色”的值应该可以通过{{ viewBag.color }}
获得。
您好! 不...我无法访问它... 不幸的是,我需要离开我的想法,并改变项目结构.... 今天我找到了https://octobercms.com/support/article/ob -19 因此,我将按照步骤进行操作,并且我将执行类似于静态页面的操作,并且将使我所有的AJAX更加轻松...但是非常感谢!你的CMS真棒! –