[英]Add page in Concrete5
我正在尝试通过Concrete5(CMS)中的代码添加页面。
$parentPage = Page::getByPath("/hotel");
$ct = CollectionType::getByHandle("products");
$data = array();
$data['cName'] = 'New Page';
$data['cDescription'] = 'Description here';
$newPage = $parentPage->add($ct, $data);
但我得到MySql错误:
mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1] in EXECUTE("select max(cDisplayOrder) from Pages where cParentID = LIMIT 1")
还有如何在创建页面时添加属性?
SQL错误对我来说意味着$ parentPage没有正确实例化。 C5令人困惑的是,即使该页面不存在, Page::getBy...()
和其他一些对象也会返回一个对象-您有责任检查它的错误。
您是否希望/hotel
存在? 您必须先创建它。 加载后,您应该使用var_dump($parentPage)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.