本文整理汇总了PHP中Model_Content::gen_seotitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Content::gen_seotitle方法的具体用法?PHP Model_Content::gen_seotitle怎么用?PHP Model_Content::gen_seotitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Content
的用法示例。
在下文中一共展示了Model_Content::gen_seotitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_create
/**
* action: EDIT
*/
public function action_create()
{
$type = $this->request->query('type');
$site = $type == 'page' ? __('Page') : __('Email');
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Create') . ' ' . $site));
$content = new Model_Content();
$languages = i18n::get_languages();
$this->template->content = View::factory('oc-panel/pages/content/create', array('locale' => $languages, 'type' => $type));
if ($p = $this->request->post()) {
foreach ($p as $name => $value) {
if ($name != 'submit') {
$content->{$name} = $value;
}
}
// if status is not checked, it is not set as POST response
$content->status = isset($p['status']) ? 1 : 0;
$content->seotitle = $content->gen_seotitle($this->request->post('title'));
try {
$content->save();
Cache::instance()->delete_all();
Alert::set(Alert::SUCCESS, $this->request->post('type') . ' ' . __('is created'));
Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'list')) . '?type=' . $p['type'] . '&locale_select=' . $p['locale']);
} catch (Exception $e) {
Alert::set(Alert::ERROR, $e->getMessage());
Request::current()->redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => 'list')) . '?type=' . $p['type'] . '&locale_select=' . $p['locale']);
}
}
}
示例2: action_create
/**
* action: EDIT
*/
public function action_create()
{
$type = core::get('type');
$site = self::translate_type($type);
Breadcrumbs::add(Breadcrumb::factory()->set_title($site)->set_url(Route::url('oc-panel', array('controller' => 'content', 'action' => $type))));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Create') . ' ' . $site));
$content = new Model_Content();
$languages = i18n::get_languages();
$this->template->content = View::factory('oc-panel/pages/content/create', array('locale' => $languages, 'type' => $type));
if ($p = $this->request->post()) {
foreach ($p as $name => $value) {
//for description we accept the HTML as comes...a bit risky but only admin can
if ($name == 'description') {
$content->description = Kohana::$_POST_ORIG['description'];
} elseif ($name != 'submit') {
$content->{$name} = $value;
}
}
// if status is not checked, it is not set as POST response
$content->status = isset($p['status']) ? 1 : 0;
if (!isset($p['seotitle'])) {
$content->seotitle = $content->gen_seotitle($this->request->post('title'));
} else {
$content->seotitle = $p['seotitle'];
}
try {
$content->save();
Alert::set(Alert::SUCCESS, $this->request->post('type') . ' ' . __('is created') . '. ' . __('Please to see the changes delete the cache') . '<br><a class="btn btn-primary btn-mini" href="' . Route::url('oc-panel', array('controller' => 'tools', 'action' => 'cache')) . '?force=1">' . __('Delete All') . '</a>');
} catch (Exception $e) {
Alert::set(Alert::ERROR, $e->getMessage());
}
HTTP::redirect(Route::url('oc-panel', array('controller' => 'content', 'action' => $p['type'])) . '?locale_select=' . $p['locale']);
}
}