本文整理汇总了PHP中TemplateHelper::BlogCategory方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateHelper::BlogCategory方法的具体用法?PHP TemplateHelper::BlogCategory怎么用?PHP TemplateHelper::BlogCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateHelper
的用法示例。
在下文中一共展示了TemplateHelper::BlogCategory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetSpecialComment
public static function SetSpecialComment($id, $comment = '')
{
$dbh = PDOQuery::getInstance();
return $dbh->update('1chan_post', array('special_comment' => $comment), 'id = ' . $dbh->q($id));
}
}
/**
* Обработчики событий класса:
*/
EventModel::getInstance()->AddEventListener('add_post', function ($data) {
$session = Session::getInstance();
$session->persistenceSet('last_post_date', time());
$session->persistenceSet('last_post_text', $data['text_original']);
$title = $data['category'] ? TemplateHelper::BlogCategory($data['category'], 'title') . ' — ' . $data['title'] : $data['title'];
JabberBot::send('-=$ /me «' . $title . '» ( ' . 'http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $data['id'] . '/ )');
Blog_BlogStatisticsModel::updateGlobalPosting();
EventModel::getInstance()->ClientBroadcast('posts', 'add_post')->ClientBroadcast('new_posts', 'add_post', array('id' => $data['id'], 'title' => $data['title'], 'category' => $data['category'] ? TemplateHelper::BlogCategory($data['category'], 'name') : 0, 'category_title' => $data['category'] ? TemplateHelper::BlogCategory($data['category'], 'title') : 0));
})->AddEventListener('rate_post', function ($data) {
EventModel::getInstance()->ClientBroadcast('posts', 'rate_post', array('id' => $data[0], 'rate' => $data[1]))->ClientBroadcast('post_' . $data[0], 'rate_post', array('id' => $data[0], 'rate' => $data[1]));
})->AddEventListener('info_post', function ($data) {
EventModel::getInstance()->ClientBroadcast('post_' . $data[0], 'info_post', array('id' => $data[0], 'comment' => $data[1]));
})->AddEventListener('rated_post', function ($data) {
list($id, $rated) = $data;
if ($rated) {
$post = Blog_BlogPostsModel::GetPost($id);
$title = $post['category'] ? TemplateHelper::BlogCategory($post['category'], 'title') . ' — ' . $post['title'] : $post['title'];
JabberBot::send($title . "\n" . 'http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $post['id'] . '/' . "\n" . str_repeat('—', 25) . "\n" . preg_replace('/\\t/', '', trim(strip_tags($post['text']))) . "\n" . str_repeat('—', 25));
//JabberBot::send('-=& /me «'. $title .'» ( '. 'http://'.TemplateHelper::getSiteUrl().'/news/res/'.$post['id'].'/ )');
EventModel::getInstance()->ClientBroadcast('posts', 'rated_post');
}
});
示例2:
<img src="<?php
echo $post['link'] ? TemplateHelper::getIcon($post['link']) : 'http://' . TemplateHelper::getSiteUrl() . '/ico/favicons/1chan.ru.gif';
?>
" width="16" height="16" alt="" />
<?php
if ($post['category']) {
?>
<a href="http://<?php
echo TemplateHelper::getSiteUrl();
?>
/news/cat/<?php
echo TemplateHelper::BlogCategory($post['category'], 'name');
?>
/" class="b-blog-entry_b-header_m-category">
<?php
echo TemplateHelper::BlogCategory($post['category'], 'title');
?>
</a>
→
<?php
}
?>
<a href="<?php
echo $post['link'] ? $post['link'] : 'http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $post['id'] . '/';
?>
" <?php
if (!empty($post['link'])) {
?>
class="m-external"<?php
}
示例3: rssAllAction
/**
* Действие просмотр rss ленты всех постов:
*/
public function rssAllAction(Application $application, Template $template)
{
$posts = Blog_BlogPostsModel::GetAllPosts(0, 20, false);
if ($posts) {
$rss = new rss('utf-8');
$rss->channel('Первый канал - Все', 'http://1chan.ru/', 'Новости имиджборд и не только.');
$rss->language('ru-ru');
$rss->copyright('Все права пренадлежат вам © 2010');
$rss->managingEditor('1kun.ebet.sobak@gmail.com');
$rss->category('Все');
$rss->startRSS();
foreach ($posts as $key => $post) {
$title = $post['category'] ? TemplateHelper::BlogCategory($post['category'], 'title') . ' — ' . $post['title'] : $post['title'];
$rss->itemTitle($title);
$rss->itemLink('http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $post['id'] . '/');
$rss->itemDescription($post['link'] ? '<a href="' . $post['link'] . '">' . $post['link'] . '</a><br />' . $post['text'] : $post['text']);
$rss->itemAuthor('anonymous');
$rss->itemGuid('http://' . TemplateHelper::getSiteUrl() . '/news/res/' . $post['id'] . '/', true);
$rss->itemPubDate(date('D, d M Y H:i:s O', $post['created_at']));
$rss->addItem();
}
$result = $rss->RSSdone();
}
EventModel::getInstance()->Broadcast('view_rss_all_post');
$template->headerOk();
$template->headerContentType('application/rss+xml', 'UTF-8');
echo $result;
return false;
}