本文整理汇总了PHP中Section::publish方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::publish方法的具体用法?PHP Section::publish怎么用?PHP Section::publish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::publish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: while
function _saveSections()
{
require_once 'AMP/Content/Section.inc.php';
$section_count = 1;
$form =& $this->get_form();
while (isset($this->_request_vars[$this->_get_section_fieldname($section_count)]) && $this->_request_vars[$this->_get_section_fieldname($section_count)]) {
$name = $this->_request_vars[$this->_get_section_fieldname($section_count)];
$text = $this->_request_vars[$this->_get_section_fieldname($section_count, 'text')];
$section = new Section(AMP_Registry::getDbcon());
$section->setName($name);
$section->setBlurb($text);
$section->setParent();
$section->setListType();
if (!($result = $section->save())) {
++$section_count;
continue;
}
$section->publish();
$section->reorder($section_count);
$form->setValues(array($this->_get_section_fieldname($section_count) => '', $this->_get_section_fieldname($section_count, 'text') => ''));
$this->message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $section->getName()));
++$section_count;
}
}
示例2: Section
function _checkNewSection($data, $fieldname)
{
if (!(isset($data['new_section_name']) && $data['new_section_name'])) {
if (!isset($data[$fieldname])) {
return false;
}
return $data[$fieldname];
}
require_once 'AMP/Content/Section.inc.php';
$section = new Section(AMP_Registry::getDbcon());
$section->setDefaults();
$section->setName($data['new_section_name']);
$section->setParent($data['new_section_parent']);
if (!($result = $section->save())) {
return $data[$fieldname];
}
$section->publish();
$flash =& AMP_System_Flash::instance();
$flash->add_message(sprintf(AMP_TEXT_DATA_SAVE_SUCCESS, $section->getName()));
return $section->id;
}