本文整理汇总了PHP中Forum::topic方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::topic方法的具体用法?PHP Forum::topic怎么用?PHP Forum::topic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::topic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
/**
* Render view.
*
* @return string
*/
public function content()
{
if (!$this->topics) {
return '';
}
ob_start();
?>
<ul class="list-unstyled">
<?php
foreach ($this->topics as $topic) {
?>
<li>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic), array('title' => HTML::chars($topic->name)));
?>
</li>
<?php
}
?>
</ul>
<?php
return ob_get_clean();
}
示例2: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
// Title
if ($this->area->description) {
echo $this->area->description . '<hr>';
}
if ($this->area->topic_count) {
// Area has topics
$last_topic = $this->area->last_topic();
$last_poster = $last_topic->last_post()->author();
?>
<div class="media">
<div class="pull-left">
<?php
echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false);
?>
</div>
<div class="media-body">
<small class="ago"><?php
echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
?>
</small>
<?php
echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster);
?>
<br>
<?php
echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name)));
?>
<br />
</div>
</div>
<small class="stats muted">
<i class="icon-comments"></i> <?php
echo Num::format($this->area->topic_count, 0);
?>
<i class="icon-comment"></i> <?php
echo Num::format($this->area->post_count, 0);
?>
</small>
<?php
} else {
// Empty area
echo __('No topics yet.');
}
return ob_get_clean();
}
示例3: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
if (count($this->topics)) {
?>
<table class="table table-condensed table-striped">
<tbody>
<?php
foreach ($this->topics as $topic) {
$last_poster = $topic->last_post()->author();
$area = $this->area ? false : $topic->area();
?>
<tr>
<td>
<h4 class="media-heading">
<?php
if ($this->area || $topic->recipient_count) {
?>
<?php
echo HTML::anchor(Route::model($topic), Forum::topic($topic));
?>
<small class="transparent"><?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="text-muted fa fa-level-down"></i>', array('title' => __('Last post')));
?>
</small>
<?php
} else {
?>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic));
?>
<small class="transparent"><?php
echo HTML::anchor(Route::model($topic), '<i class="text-muted fa fa-level-up"></i>', array('title' => __('First post')));
?>
</small>
<?php
}
?>
</h4>
<?php
if ($area) {
?>
<small class="muted">
<?php
echo HTML::anchor(Route::model($area), HTML::chars($area->name), array('class' => 'hoverable'));
?>
</small>
<?php
}
?>
</td>
<td class="text-right muted nowrap">
<small title="<?php
echo __('Replies');
?>
"><?php
echo Num::format($topic->post_count - 1, 0);
?>
<i class="fa fa-comment"></i></small>
</td>
<td>
<?php
echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, 'small');
?>
<?php
echo $last_poster ? HTML::user($last_poster) : HTML::chars($topic->last_poster);
?>
</td>
<td>
<small class="muted pull-right nowrap"><?php
echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
?>
</small>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
//.........这里部分代码省略.........
示例4: _set_title
/**
* Set page title
*
* @param Model_Forum_Topic $topic
*/
protected function _set_title(Model_Forum_Topic $topic = null)
{
$this->page_title = Forum::topic($topic);
$this->page_subtitle = HTML::icon_value(array(':views' => (int) $topic->read_count), ':views view', ':views views', 'views');
$this->page_subtitle .= HTML::icon_value(array(':replies' => $topic->post_count - 1), ':replies reply', ':replies replies', 'posts');
/*
$area = $topic->area();
if ($this->private) {
$this->page_subtitle .= ' | ' . HTML::anchor(
Forum::private_messages_url(),
__('Back to :area', array(':area' => __('Private messages'))),
array('title' => strip_tags($area->description))
);
} else {
$this->page_subtitle .= ' | ' . HTML::anchor(
Route::model($area),
__('Back to :area', array(':area' => HTML::chars($area->name))),
array('title' => strip_tags($area->description))
);
}*/
}
示例5: __
?>
</span>
<span class="grid2 latest"><?php
echo __('Latest post');
?>
</span>
</header>
<?php
foreach ($topics as $topic) {
?>
<article>
<header class="grid6 first topic">
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), Forum::topic($topic), array('class' => 'grid5 first'));
?>
<span class="grid1 replies"><?php
echo Num::format($topic->post_count - 1, 0);
?>
</span>
</header>
<p class="grid2 latest">
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::user($topic->last_poster, $topic->last_poster);
?>
示例6: content
/**
* Render view.
*
* @return string
*/
public function content()
{
ob_start();
if (count($this->topics)) {
?>
<table class="table">
<thead>
<tr>
<th class="span4 topic"><?php
echo __('Topic');
?>
</th>
<th class="span1 replies"><?php
echo __('Replies');
?>
</th>
<th class="span2 latest"><?php
echo __('Latest post');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->topics as $topic) {
?>
<tr>
<td class="topic">
<?php
echo HTML::anchor(Route::model($topic), Forum::topic($topic));
?>
<?php
echo HTML::anchor(Route::model($topic, '?page=last#last'), '<i class="muted iconic-download"></i>', array('title' => __('Last post')));
?>
</td>
<td class="replies">
<?php
echo Num::format($topic->post_count - 1, 0);
?>
</td>
<td class="latest">
<small class="ago"><?php
echo HTML::time(Date::short_span($topic->last_posted, true, true), $topic->last_posted);
?>
</small>
<?php
echo HTML::user($topic->last_poster, $topic->last_poster);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
// Empty area
echo new View_Alert(__('Here be nothing yet.'), null, View_Alert::INFO);
}
return ob_get_clean();
}