本文整理汇总了PHP中phpbb\template\template::return_display方法的典型用法代码示例。如果您正苦于以下问题:PHP template::return_display方法的具体用法?PHP template::return_display怎么用?PHP template::return_display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpbb\template\template
的用法示例。
在下文中一共展示了template::return_display方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
//.........这里部分代码省略.........
$sql_array = array('SELECT' => 'u.*', 'FROM' => array($this->users_table => 'u'), 'ORDER_BY' => $order_by);
if ($top) {
$total_users = $top;
$start = 0;
$page_title = $this->user->lang['REPUT_TOPLIST'];
} else {
$top = $this->config['topics_per_page'];
}
if ($sortparam) {
$sql_array['FROM'] = array($this->thanks_table => 't');
$sql_array['SELECT'] .= ', count(t.' . $sortparam . '_id) as count_thanks';
$sql_array['LEFT_JOIN'][] = array('FROM' => array($this->users_table => 'u'), 'ON' => 't.' . $sortparam . '_id = u.user_id');
$sql_array['GROUP_BY'] = 't.' . $sortparam . '_id';
}
$where[] = $rows[0];
for ($i = 1, $end = sizeof($rows); $i < $end; ++$i) {
$where[] = $rows[$i];
}
$sql_array['WHERE'] = $this->db->sql_in_set('u.user_id', $where);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query_limit($sql, $top, $start);
if (!($row = $this->db->sql_fetchrow($result))) {
trigger_error('NO_USER');
} else {
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
FROM ' . SESSIONS_TABLE . '
WHERE session_time >= ' . (time() - $this->config['session_length']) . '
AND ' . $this->db->sql_in_set('session_user_id', $where) . '
GROUP BY session_user_id';
$result_sessions = $this->db->sql_query($sql);
$session_times = array();
while ($session = $this->db->sql_fetchrow($result_sessions)) {
$session_times[$session['session_user_id']] = $session['session_time'];
}
$this->db->sql_freeresult($result_sessions);
$user_list = array();
$id_cache = array();
do {
$row['session_time'] = !empty($session_times[$session['user_id']]) ? $session_times[$session['user_id']] : 0;
$row['last_visit'] = !empty($session['session_time']) ? $session['session_time'] : $session['user_lastvisit'];
$user_list[] = (int) $row['user_id'];
$id_cache[$row['user_id']] = $row;
} while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
// Load custom profile fields
if ($this->config['load_cpf_memberlist']) {
$cp_row = $this->profilefields_manager->generate_profile_fields_template_headlines('field_show_on_ml');
foreach ($cp_row as $profile_field) {
$this->template->assign_block_vars('custom_fields', $profile_field);
}
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_cache = $this->profilefields_manager->grab_profile_fields_data($user_list);
// Filter the fields we don't want to show
foreach ($profile_fields_cache as $user_id => $user_profile_fields) {
foreach ($user_profile_fields as $field_ident => $profile_field) {
if (!$profile_field['data']['field_show_on_ml']) {
unset($profile_fields_cache[$user_id][$field_ident]);
}
}
}
}
//do
for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) {
$user_id = $user_list[$i];
$row = $id_cache[$user_id];
$last_visit = $row['user_lastvisit'];
$rank_title = $rank_img = $rank_img_src = '';
include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
get_user_rank($row['user_rank'], $user_id == ANONYMOUS ? false : $row['user_posts'], $rank_title, $rank_img, $rank_img_src);
$sthanks = true;
// Custom Profile Fields
$cp_row = array();
if ($this->config['load_cpf_memberlist']) {
$cp_row = isset($profile_fields_cache[$user_id]) ? $this->profilefields_manager->generate_profile_fields_template_data($profile_fields_cache[$user_id], false) : array();
}
$memberrow = array_merge(phpbb_show_profile($row), array('ROW_NUMBER' => $row_number + ($start + 1), 'RANK_TITLE' => $rank_title, 'RANK_IMG' => $rank_img, 'RANK_IMG_SRC' => $rank_img_src, 'GIVENS' => !isset($givens[$user_id]) ? 0 : $givens[$user_id], 'RECEIVED' => !isset($reseved[$user_id]) ? 0 : $reseved[$user_id], 'JOINED' => $this->user->format_date($row['user_regdate']), 'VISITED' => empty($last_visit) ? ' - ' : $this->user->format_date($last_visit), 'POSTS' => $row['user_posts'] ? $row['user_posts'] : 0, 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), 'U_SEARCH_USER' => $this->auth->acl_get('u_search') ? append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=posts") : '', 'U_SEARCH_USER_GIVENS' => $this->auth->acl_get('u_search') ? $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'true', 'tslash' => '')) : '', 'U_SEARCH_USER_RECEIVED' => $this->auth->acl_get('u_search') ? $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller_user', array('mode' => 'givens', 'author_id' => $user_id, 'give' => 'false', 'tslash' => '')) : '', 'L_VIEWING_PROFILE' => sprintf($this->user->lang['VIEWING_PROFILE'], $row['username']), 'VISITED' => empty($last_visit) ? ' - ' : $this->user->format_date($last_visit), 'S_CUSTOM_FIELDS' => isset($cp_row['row']) && sizeof($cp_row['row']) ? true : false));
if (isset($cp_row['row']) && sizeof($cp_row['row'])) {
$memberrow = array_merge($memberrow, $cp_row['row']);
}
$this->template->assign_block_vars('memberrow', $memberrow);
if (isset($cp_row['blockrow']) && sizeof($cp_row['blockrow'])) {
foreach ($cp_row['blockrow'] as $field_data) {
$this->template->assign_block_vars('memberrow.custom_fields', $field_data);
}
}
$row_number++;
}
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $this->config['topics_per_page'], $start);
$this->template->assign_vars(array('PAGE_NUMBER' => $this->pagination->on_page($total_users, $this->config['topics_per_page'], $start), 'U_SORT_POSTS' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'd', 'sd' => $sort_key == 'd' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_USERNAME' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'a', 'sd' => $sort_key == 'a' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_FROM' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'b', 'sd' => $sort_key == 'b' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_JOINED' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'c', 'sd' => $sort_key == 'c' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')), 'U_SORT_THANKS_R' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'e', 'sd' => $sort_key == 'e' && $sort_dir == 'd' ? 'a' : 'd', 'tslash' => '')), 'U_SORT_THANKS_G' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'f', 'sd' => $sort_key == 'f' && $sort_dir == 'd' ? 'a' : 'd', 'tslash' => '')), 'U_SORT_ACTIVE' => $this->auth->acl_get('u_viewonline') ? $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('mode' => $mode, 'sk' => 'l', 'sd' => $sort_key == 'l' && $sort_dir == 'a' ? 'd' : 'a', 'tslash' => '')) : ''));
}
break;
}
// Output the page
$this->template->assign_vars(array('TOTAL_USERS' => $this->user->lang('LIST_USERS', $total_users), 'U_THANKS' => $this->controller_helper->route('gfksx_ThanksForPosts_thankslist_controller', array('tslash' => '')), 'S_THANKS' => $sthanks));
page_header($page_title);
$this->template->set_filenames(array('body' => $template_html));
make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}"));
page_footer();
return new Response($this->template->return_display('body'), 200);
}
示例2: main
//.........这里部分代码省略.........
$attach_list[$row['forum_id']][] = $row['post_id'];
}
} else {
$row['post_text'] = $text_only_message;
$row['display_text_only'] = true;
}
$rowset[] = $row;
unset($text_only_message);
// Instantiate BBCode if needed
if ($bbcode_bitfield !== '' and !class_exists('bbcode')) {
include $this->phpbb_root_path . 'includes/bbcode.' . $this->php_ext;
$bbcode = new \bbcode(base64_encode($bbcode_bitfield));
}
// Replace naughty words such as farty pants
$row['post_subject'] = censor_text($row['post_subject']);
if ($row['display_text_only']) {
$row['post_text'] = get_context($row['post_text'], $words, $return_chars);
$row['post_text'] = bbcode_nl2br($row['post_text']);
} else {
// Second parse bbcode here
if ($row['bbcode_bitfield']) {
$bbcode->bbcode_second_pass($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$row['post_text'] = bbcode_nl2br($row['post_text']);
$row['post_text'] = smiley_text($row['post_text']);
}
$post_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", 'p=' . $row['post_id'] . '#p' . $row['post_id']);
$this->template->assign_block_vars('toppostrow', array('MESSAGE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_text'] : (!empty($row['forum_id']) ? $this->user->lang['SORRY_AUTH_READ'] : $row['post_text']), 'POST_DATE' => !empty($row['post_time']) ? $this->user->format_date($row['post_time']) : '', 'MINI_POST_IMG' => $this->user->img('icon_post_target', 'POST'), 'POST_ID' => $post_url, 'POST_SUBJECT' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['post_subject'] : (!empty($row['forum_id']) ? '' : $row['post_subject']), 'POST_AUTHOR' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), 'POST_REPUT' => round($row['post_thanks'] / ($max_post_thanks / 100), $this->config['thanks_number_digits']) . '%', 'POST_THANKS' => $row['post_thanks'], 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false, 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false, 'THANKS_REPUT_HEIGHT' => sprintf('%dpx', $this->config['thanks_reput_height']), 'THANKS_REPUT_GRAPHIC_WIDTH' => sprintf('%dpx', $this->config['thanks_reput_level'] * $this->config['thanks_reput_height']), 'THANKS_REPUT_IMAGE' => isset($this->config['thanks_reput_image']) ? $this->phpbb_root_path . $this->config['thanks_reput_image'] : '', 'THANKS_REPUT_IMAGE_BACK' => isset($this->config['thanks_reput_image_back']) ? $this->phpbb_root_path . $this->config['thanks_reput_image_back'] : ''));
} while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
}
}
//topic rating
if (!$full_forum_rating && !$full_post_rating && $this->config['thanks_topic_reput_view']) {
$end = $full_topic_rating ? $this->config['topics_per_page'] : $end_row_rating;
$sql_t_array['FROM'] = array($this->thanks_table => 'f');
$sql_t_array['SELECT'] = 'u.user_id, u.username, u.user_colour, t.topic_title, t.topic_id, t.topic_time, t.topic_poster, t.topic_first_poster_name, t.topic_first_poster_colour, t.forum_id, t.topic_type, t.topic_status, t.poll_start';
$sql_t_array['SELECT'] .= ', f.topic_id, COUNT(*) AS topic_thanks';
$sql_t_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'f.topic_id = t.topic_id');
$sql_t_array['LEFT_JOIN'][] = array('FROM' => array($this->users_table => 'u'), 'ON' => 't.topic_poster = u.user_id');
$sql_t_array['GROUP_BY'] = 'f.topic_id';
$sql_t_array['ORDER_BY'] = 'topic_thanks DESC';
$sql_t_array['WHERE'] = $this->db->sql_in_set('f.forum_id', $ex_fid_ary, true);
$sql = $this->db->sql_build_query('SELECT', $sql_t_array);
$result = $this->db->sql_query_limit($sql, $end, $start);
$u_search_topic = append_sid("{$this->phpbb_root_path}toplist", "mode=topic");
if (!($row = $this->db->sql_fetchrow($result))) {
trigger_error('RATING_VIEW_TOPLIST_NO');
} else {
$notoplist = false;
do {
// Get folder img, topic status/type related information
$folder_img = $folder_alt = $topic_type = '';
topic_status($row, 0, false, $folder_img, $folder_alt, $topic_type);
$view_topic_url_params = 'f=' . ($row['forum_id'] ? $row['forum_id'] : '') . '&t=' . $row['topic_id'];
$view_topic_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->php_ext}", $view_topic_url_params);
$this->template->assign_block_vars('toptopicrow', array('TOPIC_IMG_STYLE' => $folder_img, 'TOPIC_FOLDER_IMG_SRC' => $row['forum_id'] ? 'topic_read' : 'announce_read', 'TOPIC_TITLE' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['topic_title'] : (!empty($row['forum_id']) ? $this->user->lang['SORRY_AUTH_READ'] : $row['topic_title']), 'U_VIEW_TOPIC' => $view_topic_url, 'TOPIC_AUTHOR' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_THANKS' => $row['topic_thanks'], 'TOPIC_REPUT' => round($row['topic_thanks'] / ($max_topic_thanks / 100), $this->config['thanks_number_digits']) . '%', 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']) ? $this->config['thanks_topic_reput_view'] : false, 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false, 'THANKS_REPUT_HEIGHT' => sprintf('%dpx', $this->config['thanks_reput_height']), 'THANKS_REPUT_GRAPHIC_WIDTH' => sprintf('%dpx', $this->config['thanks_reput_level'] * $this->config['thanks_reput_height']), 'THANKS_REPUT_IMAGE' => isset($this->config['thanks_reput_image']) ? $this->phpbb_root_path . $this->config['thanks_reput_image'] : '', 'THANKS_REPUT_IMAGE_BACK' => isset($this->config['thanks_reput_image_back']) ? $this->phpbb_root_path . $this->config['thanks_reput_image_back'] : ''));
} while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
}
}
//forum rating
if (!$full_topic_rating && !$full_post_rating && $this->config['thanks_forum_reput_view']) {
$end = $full_forum_rating ? $this->config['topics_per_page'] : $end_row_rating;
$sql_f_array['FROM'] = array($this->thanks_table => 't');
$sql_f_array['SELECT'] = 'f.forum_name, f.forum_id';
$sql_f_array['SELECT'] .= ', t.forum_id, COUNT(*) AS forum_thanks';
$sql_f_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 't.forum_id = f.forum_id');
$sql_f_array['GROUP_BY'] = 't.forum_id';
$sql_f_array['ORDER_BY'] = 'forum_thanks DESC';
$sql_f_array['WHERE'] = $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true);
$sql = $this->db->sql_build_query('SELECT', $sql_f_array);
$result = $this->db->sql_query_limit($sql, $end, $start);
$u_search_forum = append_sid("{$this->phpbb_root_path}toplist", "mode=forum");
if (!($row = $this->db->sql_fetchrow($result))) {
trigger_error('RATING_VIEW_TOPLIST_NO');
} else {
$notoplist = false;
do {
if (!empty($row['forum_id'])) {
$u_viewforum = append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}", 'f=' . $row['forum_id']);
$folder_image = 'forum_read';
$this->template->assign_block_vars('topforumrow', array('FORUM_FOLDER_IMG_SRC' => $this->user->img('forum_read', 'NO_NEW_POSTS', false, '', 'src'), 'FORUM_IMG_STYLE' => $folder_image, 'FORUM_NAME' => $this->auth->acl_get('f_read', $row['forum_id']) ? $row['forum_name'] : (!empty($row['forum_id']) ? $this->user->lang['SORRY_AUTH_READ'] : $row['forum_name']), 'U_VIEW_FORUM' => $u_viewforum, 'FORUM_THANKS' => $row['forum_thanks'], 'FORUM_REPUT' => round($row['forum_thanks'] / ($max_forum_thanks / 100), $this->config['thanks_number_digits']) . '%', 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']) ? $this->config['thanks_forum_reput_view'] : false, 'S_THANKS_REPUT_GRAPHIC' => isset($this->config['thanks_reput_graphic']) ? $this->config['thanks_reput_graphic'] : false, 'THANKS_REPUT_HEIGHT' => sprintf('%dpx', $this->config['thanks_reput_height']), 'THANKS_REPUT_GRAPHIC_WIDTH' => sprintf('%dpx', $this->config['thanks_reput_level'] * $this->config['thanks_reput_height']), 'THANKS_REPUT_IMAGE' => isset($this->config['thanks_reput_image']) ? $this->phpbb_root_path . $this->config['thanks_reput_image'] : '', 'THANKS_REPUT_IMAGE_BACK' => isset($this->config['thanks_reput_image_back']) ? $this->phpbb_root_path . $this->config['thanks_reput_image_back'] : ''));
}
} while ($row = $this->db->sql_fetchrow($result));
$this->db->sql_freeresult($result);
}
}
if ($notoplist) {
trigger_error('RATING_VIEW_TOPLIST_NO');
}
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_match_count, $this->config['topics_per_page'], $start);
// Output the page
$this->template->assign_vars(array('PAGE_NUMBER' => $this->pagination->on_page($total_match_count, $this->config['posts_per_page'], $start), 'PAGE_TITLE' => $page_title, 'S_THANKS_FORUM_REPUT_VIEW' => isset($this->config['thanks_forum_reput_view']) ? $this->config['thanks_forum_reput_view'] : false, 'S_THANKS_TOPIC_REPUT_VIEW' => isset($this->config['thanks_topic_reput_view']) ? $this->config['thanks_topic_reput_view'] : false, 'S_THANKS_POST_REPUT_VIEW' => isset($this->config['thanks_post_reput_view']) ? $this->config['thanks_post_reput_view'] : false, 'S_FULL_POST_RATING' => $full_post_rating, 'S_FULL_TOPIC_RATING' => $full_topic_rating, 'S_FULL_FORUM_RATING' => $full_forum_rating, 'U_SEARCH_POST' => $u_search_post, 'U_SEARCH_TOPIC' => $u_search_topic, 'U_SEARCH_FORUM' => $u_search_forum));
page_header($page_title);
$this->template->set_filenames(array('body' => 'toplist_body.html'));
make_jumpbox(append_sid("{$this->phpbb_root_path}viewforum.{$this->php_ext}"));
page_footer();
return new Response($this->template->return_display('body'), 200);
}