本文整理汇总了PHP中TPL::is_output方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::is_output方法的具体用法?PHP TPL::is_output怎么用?PHP TPL::is_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::is_output方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index_action
public function index_action()
{
if (!$this->user_id) {
HTTP::redirect('/explore/');
}
if (!$this->user_info['email']) {
HTTP::redirect('/account/complete_profile/');
}
// 边栏可能感兴趣的人或话题
if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'home/index')) {
$recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id);
TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics);
}
// 边栏热门用户
if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'home/index')) {
$sidebar_hot_users = $this->model('module')->sidebar_hot_users($this->user_id);
TPL::assign('sidebar_hot_users', $sidebar_hot_users);
}
$this->crumb(AWS_APP::lang()->_t('动态'), '/home/');
TPL::import_js('js/app/index.js');
if ($_GET['first_login']) {
TPL::import_js('js/ajaxupload.js');
}
TPL::output('home/index');
}
示例2: index_action
public function index_action()
{
if ($_GET['tag']) {
$this->crumb(AWS_APP::lang()->_t('标签') . ': ' . $_GET['tag'], '/favorite/tag-' . $_GET['tag']);
}
//边栏可能感兴趣的人或话题
if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'favorite/index')) {
$recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id);
TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics);
}
if ($action_list = $this->model('favorite')->get_item_list($_GET['tag'], $this->user_id, calc_page_limit($_GET['page'], get_setting('contents_per_page')))) {
foreach ($action_list as $key => $val) {
$item_ids[] = $val['item_id'];
}
TPL::assign('list', $action_list);
} else {
if (!$_GET['page'] or $_GET['page'] == 1) {
$this->model('favorite')->remove_favorite_tag(null, null, $_GET['tag'], $this->user_id);
}
}
if ($item_ids) {
$favorite_items_tags = $this->model('favorite')->get_favorite_items_tags_by_item_id($this->user_id, $item_ids);
TPL::assign('favorite_items_tags', $favorite_items_tags);
}
TPL::assign('favorite_tags', $this->model('favorite')->get_favorite_tags($this->user_id));
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/favorite/tag-' . $_GET['tag']), 'total_rows' => $this->model('favorite')->count_favorite_items($this->user_id, $_GET['tag']), 'per_page' => get_setting('contents_per_page')))->create_links());
TPL::output('favorite/index');
}
示例3: index_square_action
public function index_square_action()
{
$this->crumb(AWS_APP::lang()->_t('问题'), '/question/');
// 导航
if (TPL::is_output('block/content_nav_menu.tpl.htm', 'question/square')) {
TPL::assign('content_nav_menu', $this->model('menu')->get_nav_menu_list('question'));
}
//边栏可能感兴趣的人
if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'question/square')) {
TPL::assign('sidebar_recommend_users_topics', $this->model('module')->recommend_users_topics($this->user_id));
}
//边栏热门用户
if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'question/square')) {
TPL::assign('sidebar_hot_users', $this->model('module')->sidebar_hot_users($this->user_id, 5));
}
//边栏热门话题
if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'question/square')) {
TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($_GET['category']));
}
//边栏专题
if (TPL::is_output('block/sidebar_feature.tpl.htm', 'question/square')) {
TPL::assign('feature_list', $this->model('module')->feature_list());
}
if ($_GET['category']) {
if (is_digits($_GET['category'])) {
$category_info = $this->model('system')->get_category_info($_GET['category']);
} else {
$category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
}
}
if ($category_info) {
TPL::assign('category_info', $category_info);
$this->crumb($category_info['title'], '/question/category-' . $category_info['id']);
$meta_description = $category_info['title'];
if ($category_info['description']) {
$meta_description .= ' - ' . $category_info['description'];
}
TPL::set_meta('description', $meta_description);
}
if ($_GET['feature_id']) {
$feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id']);
TPL::assign('feature_info', $feature_info);
}
if ($feature_info['id']) {
$topic_ids = $this->model('feature')->get_topics_by_feature_id($feature_info['id']);
}
if (!$_GET['sort_type']) {
$_GET['sort_type'] = 'new';
}
if ($_GET['sort_type'] == 'hot') {
$question_list = $this->model('posts')->get_hot_posts('question', $category_info['id'], $topic_ids, $_GET['day'], $_GET['page'], get_setting('contents_per_page'));
} else {
$question_list = $this->model('posts')->get_posts_list('question', $_GET['page'], get_setting('contents_per_page'), $_GET['sort_type'], $topic_ids, $category_info['id'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
}
if ($question_list) {
foreach ($question_list as $key => $val) {
if ($val['answer_count']) {
$question_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
}
}
}
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/question/sort_type-' . preg_replace("/[\\(\\)\\.;']/", '', $_GET['sort_type']) . '__category-' . $category_info['id'] . '__day-' . intval($_GET['day']) . '__is_recommend-' . $_GET['is_recommend']) . '__feature_id-' . $feature_info['id'], 'total_rows' => $this->model('posts')->get_posts_list_total(), 'per_page' => get_setting('contents_per_page')))->create_links());
TPL::assign('posts_list', $question_list);
TPL::assign('question_list_bit', TPL::output('explore/ajax/list', false));
TPL::output('question/square');
}
示例4: index_action
//.........这里部分代码省略.........
// {
// $related_topics_ids[$val['topic_id']] = $val['topic_id'];
// }
// }
// if ($child_topic_ids = $this->model('topic')->get_child_topic_ids($topic_info['topic_id']))
// {
// foreach ($child_topic_ids AS $key => $topic_id)
// {
// $related_topics_ids[$topic_id] = $topic_id;
// }
// }
// TPL::assign('related_topics', $related_topics);
// $log_list = ACTION_LOG::get_action_by_event_id($topic_info['topic_id'], 10, ACTION_LOG::CATEGORY_TOPIC, implode(',', array(
// ACTION_LOG::ADD_TOPIC,
// ACTION_LOG::MOD_TOPIC,
// ACTION_LOG::MOD_TOPIC_DESCRI,
// ACTION_LOG::MOD_TOPIC_PIC,
// ACTION_LOG::DELETE_TOPIC,
// ACTION_LOG::ADD_RELATED_TOPIC,
// ACTION_LOG::DELETE_RELATED_TOPIC
// )), -1);
// $log_list = $this->model('topic')->analysis_log($log_list);
// $contents_topic_id = $topic_info['topic_id'];
// $contents_topic_title = $topic_info['topic_title'];
// if ($merged_topics = $this->model('topic')->get_merged_topic_ids($topic_info['topic_id']))
// {
// foreach ($merged_topics AS $key => $val)
// {
// $merged_topic_ids[] = $val['source_id'];
// }
// $contents_topic_id .= ',' . implode(',', $merged_topic_ids);
// if ($merged_topics_info = $this->model('topic')->get_topics_by_ids($merged_topic_ids))
// {
// foreach($merged_topics_info AS $key => $val)
// {
// $merged_topic_title[] = $val['topic_title'];
// }
// }
// if ($merged_topic_title)
// {
// $contents_topic_title .= ',' . implode(',', $merged_topic_title);
// }
// }
// // $contents_related_topic_ids = array_merge($related_topics_ids, explode(',', $contents_topic_id));
// // TPL::assign('contents_related_topic_ids', implode(',', $contents_related_topic_ids));
// // if ($posts_list = $this->model('posts')->get_posts_list(null, 1, get_setting('contents_per_page'), 'new', $contents_related_topic_ids))
// // {
// // foreach ($posts_list AS $key => $val)
// // {
// // if ($val['answer_count'])
// // {
// // $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
// // }
// // }
// // }
// // TPL::assign('posts_list', $posts_list);
// // TPL::assign('all_list_bit', TPL::output('explore/ajax/list', false));
// // if ($posts_list = $this->model('posts')->get_posts_list(null, 1, get_setting('contents_per_page'), null, $contents_related_topic_ids, null, null, 30, true))
// // {
// // foreach ($posts_list AS $key => $val)
// // {
// // if ($val['answer_count'])
// // {
// // $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
// // }
// // }
// // }
// 问题列表
$question_list = $this->model('topic')->get_question_list_by_topic($topic_info['topic_id'], $_GET['page'], get_setting('contents_per_page'));
if ($question_list) {
foreach ($question_list as $key => $val) {
$this->model('question')->load_list_question_info($question_list[$key], $val, $this->user_id);
}
}
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/topic/id-' . $topic_info['topic_id'] . '__page-', $_GET['page']), 'total_rows' => $this->model('topic')->get_question_list_total(), 'per_page' => get_setting('contents_per_page'), 'num_links' => 2))->create_links());
TPL::assign('question_list', $question_list);
//边栏热门话题
if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'question/square')) {
TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($_GET['category'], 4));
}
// TPL::assign('topic_recommend_list', $posts_list);
// TPL::assign('posts_list', $posts_list);
// TPL::assign('recommend_list_bit', TPL::output('explore/ajax/list', false));
// TPL::assign('list', $this->model('topic')->get_topic_best_answer_action_list($contents_topic_id, $this->user_id, get_setting('contents_per_page')));
// TPL::assign('best_questions_list_bit', TPL::output('home/ajax/index_actions', false));
// TPL::assign('posts_list', $this->model('posts')->get_posts_list('question', 1, get_setting('contents_per_page'), 'new', explode(',', $contents_topic_id)));
// TPL::assign('all_questions_list_bit', TPL::output('explore/ajax/list', false));
// TPL::assign('posts_list', $this->model('posts')->get_posts_list('article', 1, get_setting('contents_per_page'), 'new', explode(',', $contents_topic_id)));
// TPL::assign('articles_list_bit', TPL::output('explore/ajax/list', false));
// TPL::assign('contents_topic_id', $contents_topic_id);
// TPL::assign('contents_topic_title', $contents_topic_title);
// TPL::assign('log_list', $log_list);
// TPL::assign('redirect_message', $redirect_message);
if ($topic_info['parent_id']) {
TPL::assign('parent_topic_info', $this->model('topic')->get_topic_by_id($topic_info['parent_id']));
}
TPL::output('topic/index');
break;
}
}
示例5: index_square_action
public function index_square_action()
{
if (is_mobile()) {
HTTP::redirect('/m/article/');
}
$this->crumb(AWS_APP::lang()->_t('文章'), '/article/');
if ($_GET['category']) {
if (is_digits($_GET['category'])) {
$category_info = $this->model('system')->get_category_info($_GET['category']);
} else {
$category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
}
}
if ($_GET['feature_id']) {
$article_list = $this->model('article')->get_articles_list_by_topic_ids($_GET['page'], get_setting('contents_per_page'), 'add_time DESC', $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']));
$article_list_total = $this->model('article')->article_list_total;
if ($feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id'])) {
$this->crumb($feature_info['title'], '/article/feature_id-' . $feature_info['id']);
TPL::assign('feature_info', $feature_info);
}
} else {
$article_list = $this->model('article')->get_articles_list($category_info['id'], $_GET['page'], get_setting('contents_per_page'), 'add_time DESC');
$article_list_total = $this->model('article')->found_rows();
}
if ($article_list) {
foreach ($article_list as $key => $val) {
$article_ids[] = $val['id'];
$article_uids[$val['uid']] = $val['uid'];
}
$article_topics = $this->model('topic')->get_topics_by_item_ids($article_ids, 'article');
$article_users_info = $this->model('account')->get_user_info_by_uids($article_uids);
foreach ($article_list as $key => $val) {
$article_list[$key]['user_info'] = $article_users_info[$val['uid']];
}
}
// 导航
if (TPL::is_output('block/content_nav_menu.tpl.htm', 'article/square')) {
TPL::assign('content_nav_menu', $this->model('menu')->get_nav_menu_list('article'));
}
//边栏热门话题
if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'article/square')) {
TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
}
if ($category_info) {
TPL::assign('category_info', $category_info);
$this->crumb($category_info['title'], '/article/category-' . $category_info['id']);
$meta_description = $category_info['title'];
if ($category_info['description']) {
$meta_description .= ' - ' . $category_info['description'];
}
TPL::set_meta('description', $meta_description);
}
TPL::assign('article_list', $article_list);
TPL::assign('article_topics', $article_topics);
TPL::assign('hot_articles', $this->model('article')->get_articles_list(null, 1, 10, 'votes DESC'));
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/article/category_id-' . $_GET['category_id'] . '__feature_id-' . $_GET['feature_id']), 'total_rows' => $article_list_total, 'per_page' => get_setting('contents_per_page')))->create_links());
TPL::output('article/square');
}
示例6: index_action
public function index_action()
{
if (is_mobile()) {
HTTP::redirect('/m/explore/' . $_GET['id']);
}
if ($this->user_id) {
$this->crumb(AWS_APP::lang()->_t('发现'), '/question');
if (!$this->user_info['email']) {
HTTP::redirect('/account/complete_profile/');
}
}
if ($_GET['category']) {
if (is_digits($_GET['category'])) {
$category_info = $this->model('system')->get_category_info($_GET['category']);
} else {
$category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
}
}
if ($category_info) {
TPL::assign('category_info', $category_info);
$this->crumb($category_info['title'], '/category-' . $category_info['id']);
$meta_description = $category_info['title'];
if ($category_info['description']) {
$meta_description .= ' - ' . $category_info['description'];
}
TPL::set_meta('description', $meta_description);
}
// 导航
if (TPL::is_output('block/content_nav_menu.tpl.htm', 'explore/index')) {
TPL::assign('content_nav_menu', $this->model('menu')->get_nav_menu_list('explore'));
}
// 边栏可能感兴趣的人
if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'explore/index')) {
if ($this->user_id) {
TPL::assign('sidebar_recommend_users_topics', $this->model('module')->recommend_users_topics($this->user_id));
}
}
// 边栏热门用户
if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'explore/index')) {
TPL::assign('sidebar_hot_users', $this->model('module')->sidebar_hot_users($this->user_id, 8));
}
// 边栏热门话题
if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'explore/index')) {
TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
}
// 边栏专题
if (TPL::is_output('block/sidebar_feature.tpl.htm', 'explore/index')) {
TPL::assign('feature_list', $this->model('module')->feature_list());
}
//最近所有热门
if (TPL::is_output('block/near_hots_square.tpl.htm', 'explore/index')) {
$posts_list = $this->model('posts')->get_hot_posts(null, $category_info['id'], null, $_GET['day'], $_GET['page'], 12);
TPL::assign('near_posts_list', $posts_list);
}
if (!$_GET['sort_type'] and !$_GET['is_recommend']) {
$_GET['sort_type'] = 'new';
}
if ($_GET['sort_type'] !== 'new' && isset($_GET['sort_type']) or isset($_GET['is_recommend'])) {
Header("HTTP/1.1 301 Moved Permanently");
$url = "/question" . $_SERVER[REQUEST_URI];
HTTP::redirect($url);
} else {
$posts_list = $this->model('posts')->get_posts_list(null, $_GET['page'], get_setting('contents_per_page'), $_GET['sort_type'], null, $category_info['id'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
}
if ($posts_list) {
foreach ($posts_list as $key => $val) {
if ($val['answer_count']) {
$posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
}
}
}
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/sort_type-' . preg_replace("/[\\(\\)\\.;']/", '', $_GET['sort_type']) . '__category-' . $category_info['id'] . '__day-' . intval($_GET['day']) . '__is_recommend-' . intval($_GET['is_recommend'])), 'total_rows' => $this->model('posts')->get_posts_list_total(), 'per_page' => get_setting('contents_per_page')))->create_links());
TPL::assign('posts_list', $posts_list);
TPL::assign('posts_list_bit', TPL::output('explore/ajax/list', false));
TPL::output('explore/index');
}
示例7: recommend_action
public function recommend_action()
{
if (is_mobile()) {
HTTP::redirect('/m/article/');
}
$this->crumb(AWS_APP::lang()->_t('推荐文章'), '/article/');
if ($_GET['feature_id']) {
$article_list = $this->model('article')->get_articles_list_by_topic_ids($_GET['page'], get_setting('contents_per_page'), 'is_recommend DESC', $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']));
$article_list_total = $this->model('article')->article_list_total;
if ($feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id'])) {
$this->crumb($feature_info['title'], '/article/feature_id-' . $feature_info['id']);
TPL::assign('feature_info', $feature_info);
}
} else {
$article_list = $this->model('article')->get_articles_list($category_info['id'], $_GET['page'], get_setting('contents_per_page'), 'is_recommend DESC');
$article_list_total = $this->model('article')->found_rows();
}
if ($article_list) {
foreach ($article_list as $key => $val) {
$article_ids[] = $val['id'];
$article_uids[$val['uid']] = $val['uid'];
}
$article_topics = $this->model('topic')->get_topics_by_item_ids($article_ids, 'article');
$article_users_info = $this->model('account')->get_user_info_by_uids($article_uids);
foreach ($article_list as $key => $val) {
$article_list[$key]['user_info'] = $article_users_info[$val['uid']];
}
}
if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'article/square')) {
TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
}
TPL::assign('hot_articles', $this->model('article')->get_articles_list(null, 1, 10, 'votes DESC'));
TPL::assign('article_list', $article_list);
TPL::output('article/square');
}
示例8: index_square_action
public function index_square_action()
{
$this->crumb(AWS_APP::lang()->_t('知识'), '/article/');
if ($_GET['category']) {
if (is_digits($_GET['category'])) {
$category_info = $this->model('system')->get_category_info($_GET['category']);
} else {
$category_info = $this->model('system')->get_category_info_by_url_token($_GET['category']);
}
}
if ($_GET['feature_id']) {
$article_list = $this->model('article')->get_articles_list_by_topic_ids($_GET['page'], get_setting('contents_per_page'), 'add_time DESC', $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']));
$article_list_total = $this->model('article')->article_list_total;
if ($feature_info = $this->model('feature')->get_feature_by_id($_GET['feature_id'])) {
$this->crumb($feature_info['title'], '/article/feature_id-' . $feature_info['id']);
TPL::assign('feature_info', $feature_info);
}
} else {
$article_list = $this->model('article')->get_articles_list($category_info['id'], $_GET['page'], get_setting('contents_per_page'), 'add_time DESC');
$article_list_total = $this->model('article')->found_rows();
}
if ($article_list) {
foreach ($article_list as $key => $val) {
$article_ids[] = $val['id'];
$article_uids[$val['uid']] = $val['uid'];
}
$article_topics = $this->model('topic')->get_topics_by_item_ids($article_ids, 'article');
$article_users_info = $this->model('account')->get_user_info_by_uids($article_uids);
// 获取文章缩略图
$article_attachs = $this->model('publish')->get_attachs('article', $article_ids, 'min');
foreach ($article_list as $key => $val) {
$article_list[$key]['user_info'] = $article_users_info[$val['uid']];
if ($val['has_attach']) {
$article_list[$key]['attachs'] = $article_attachs[$val['id']];
}
// 文章分类信息
$article_list[$key]['category_info'] = $this->model('system')->get_category_info($val['category_id']);
}
}
//边栏热门话题
if (TPL::is_output('block/sidebar_hot_topics.tpl.htm', 'article/square')) {
TPL::assign('sidebar_hot_topics', $this->model('module')->sidebar_hot_topics($category_info['id']));
}
if ($category_info) {
TPL::assign('category_info', $category_info);
$this->crumb($category_info['title'], '/article/category-' . $category_info['id']);
$meta_description = $category_info['title'];
if ($category_info['description']) {
$meta_description .= ' - ' . $category_info['description'];
}
TPL::set_meta('description', $meta_description);
}
TPL::assign('article_categories', $this->model('system')->fetch_category('article', 0));
TPL::assign('article_list', $article_list);
TPL::assign('article_topics', $article_topics);
// 推荐文章
TPL::assign('recommend_articles', $this->model('article')->get_recommend_article_list(null, 4));
// 热门文章
$hot_articles = $this->model('article')->get_articles_list(null, 1, 8, 'votes DESC', null);
foreach ($hot_articles as $key => $val) {
$article_ids[] = $val['id'];
}
$article_attachs = $this->model('publish')->get_attachs('article', $article_ids, 'min');
foreach ($hot_articles as $key => $val) {
$hot_articles[$key]['attachs'] = $article_attachs[$val['id']];
}
TPL::assign('hot_articles', $hot_articles);
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/article/category_id-' . $_GET['category_id'] . '__feature_id-' . $_GET['feature_id']), 'total_rows' => $article_list_total, 'per_page' => get_setting('contents_per_page')))->create_links());
TPL::output('article/square');
}