本文整理汇总了PHP中Model_Content::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Content::get方法的具体用法?PHP Model_Content::get怎么用?PHP Model_Content::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Content
的用法示例。
在下文中一共展示了Model_Content::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_view
/**
*
* Display single page
* @throws HTTP_Exception_404
*/
public function action_view()
{
$seotitle = $this->request->param('seotitle', NULL);
if ($seotitle !== NULL) {
$page = Model_Content::get($seotitle);
if ($page->loaded()) {
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title($page->title));
$this->template->title = $page->title;
$this->template->meta_description = $page->description;
$this->template->bind('content', $content);
$this->template->content = View::factory('page', array('page' => $page));
} else {
//throw 404
throw new HTTP_Exception_404();
}
} else {
//throw 404
throw new HTTP_Exception_404();
}
}
示例2: defined
<?php
defined('SYSPATH') or die('No direct script access.');
?>
<div id="accept_terms_modal" class="modal fade" data-backdrop="static">
<?php
$content = Model_Content::get(core::config('general.alert_terms'));
?>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" onclick='location.href="http://www.google.com"' aria-hidden="true">×</button>
<h1><?php
echo $content->title;
?>
</h1>
</div>
<div class="modal-body">
<p><?php
echo Text::bb2html($content->description, TRUE);
?>
</p>
</div>
<div class="modal-footer">
<a name="decline_terms" class="btn btn-default" onclick='location.href="http://www.google.com"' ><?php
echo __('No');
?>
</a>
<a name="accept_terms" class="btn btn-success" onclick='setCookie("accept_terms",1,10000)' data-dismiss="modal" aria-hidden="true"><?php
echo __('I accept');
示例3: content
/**
* sends an email using content from model_content
* @param string $to
* @param string $to_name
* @param string $from
* @param string $from_name
* @param string $content seotitle from Model_Content
* @param array $replace key value to replace at subject and body
* @param array $file file to attach to email
* @return boolean s
*/
public static function content($to, $to_name = '', $from = NULL, $from_name = NULL, $content, $replace, $file = NULL)
{
$email = Model_Content::get($content, 'email');
$ad_obj = new Model_Ad();
//content found
if ($email->loaded()) {
if ($replace === NULL) {
$replace = array();
}
if ($from === NULL) {
$from = $email->from_email;
}
if ($from_name === NULL) {
$from_name = core::config('general.site_name');
}
if (isset($file) and $ad_obj->is_valid_file($file)) {
$file_upload = $file;
} else {
$file_upload = NULL;
}
//adding extra replaces
$replace += array('[SITE.NAME]' => core::config('general.site_name'), '[SITE.URL]' => core::config('general.base_url'), '[USER.NAME]' => $to_name, '[USER.EMAIL]' => $to);
//adding anchor tags to any [URL.* match
foreach ($replace as $key => $value) {
if (strpos($key, '[URL.') === 0 or $key == '[SITE.URL]') {
$replace[$key] = '[url=' . $value . ']' . $value . '[/url]';
}
}
$subject = str_replace(array_keys($replace), array_values($replace), $email->title);
$body = str_replace(array_keys($replace), array_values($replace), $email->description);
return Email::send($to, $to_name, $subject, $body, $from, $from_name, $file_upload);
} else {
return FALSE;
}
}