本文整理匯總了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;
}