我一直在关注Silverstripe DataObjects as Pages - Part 2: Using Model Admin and URL Segments to create a product catalog tutorial on my localhost and running into a sidebar problem。
当我使用与教程一相同的方法创建侧边栏时,我的网站上显示一条错误消息 [User Error] Uncaught Exception: Object->__call(): the method 'categorypages' does not exist on 'Product'
这是我添加到 Product.php 以显示侧边栏的代码。
//Return the Title as a menu title
public function MenuTitle()
{
return $this->Title;
}
//确保DO显示在菜单中(需要它,否则未登录时侧边栏不显示)
function canView()
{
return $this->CategoryPages()->canView();
}
有谁知道如何解决这个问题?非常感谢。