本文整理匯總了PHP中post::updateTags方法的典型用法代碼示例。如果您正苦於以下問題:PHP post::updateTags方法的具體用法?PHP post::updateTags怎麽用?PHP post::updateTags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類post
的用法示例。
在下文中一共展示了post::updateTags方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
public function edit($id = NULL)
{
$id = (int) $id;
if (!$id) {
$this->redirect('admin');
}
$statuses = array("publish", "draft");
if ($this->data) {
if (isset($this->data['cancelar'])) {
$this->redirect("admin/");
} else {
$P = new post();
$P->find($id);
if (!preg_match("/\\S+/", $this->data['title']) or $this->data['title'] == "") {
$this->data['title'] = "Untitled";
}
if (!preg_match("/\\S+/", $this->data['urlfriendly']) or $this->data['urlfriendly'] == "") {
$this->data['urlfriendly'] = $this->data['title'];
}
$this->data['urlfriendly'] = $P->buildUrl($this->data['urlfriendly'], $id);
$P->updateTags($id, $this->data['tags']);
unset($this->data['tags']);
$P->prepareFromArray($this->data);
$P->save();
$this->session->flash('Información guardada correctamente.');
$this->redirect("admin/edit/{$id}");
}
}
$P = new post();
$post = $P->find($id);
$post['title'] = utils::convert2HTML($P['title']);
$post['content'] = utils::convert2HTML($P['content']);
$post['tags'] = $P->getTags($id, 'string');
$this->title_for_layout($this->l10n->__("Editar post - Codice CMS"));
$this->view->id = $id;
$this->view->post = $post;
$this->view->statuses = $statuses;
$this->view->setLayout("admin");
$this->render();
}