mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 07:35:29 +02:00
- made path information available to template (T_)
- eased topic/post icon in templates (removing hardcoded img) - added S_FIRST_ROW and S_LAST_ROW to template engine git-svn-id: file:///svn/phpbb/trunk@5118 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
557d09bb72
commit
d92380657d
@ -1900,6 +1900,12 @@ function page_header($page_title = '')
|
||||
'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['primary']['template_path'] . '/template',
|
||||
'T_IMAGESET_PATH' => "{$phpbb_root_path}styles/" . $user->theme['primary']['imageset_path'] . '/imageset',
|
||||
'T_IMAGESET_LANG_PATH' => "{$phpbb_root_path}styles/" . $user->theme['primary']['imageset_path'] . '/imageset/' . $user->data['user_lang'],
|
||||
'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/",
|
||||
'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/",
|
||||
'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/",
|
||||
'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/",
|
||||
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
|
||||
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
|
||||
'T_STYLESHEET_LINK' => (!$user->theme['primary']['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['primary']['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['primary']['theme_id'],
|
||||
'T_STYLESHEET_NAME' => $user->theme['primary']['theme_name'],
|
||||
'T_THEME_DATA' => (!$user->theme['primary']['theme_storedb']) ? '' : $user->theme['primary']['theme_data'])
|
||||
|
@ -304,7 +304,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
|
||||
|
||||
'FORUM_ID' => $row['forum_id'],
|
||||
'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $folder_alt . '" border="0" />' : $user->img($folder_image, $folder_alt),
|
||||
'FORUM_FOLDER_IMG' => ($row['forum_image']) ? '<img src="' . $phpbb_root_path . $row['forum_image'] . '" alt="' . $folder_alt . '" />' : $user->img($folder_image, $folder_alt),
|
||||
'FORUM_NAME' => $row['forum_name'],
|
||||
'FORUM_DESC' => $row['forum_desc'],
|
||||
$l_post_click_count => $post_click_count,
|
||||
|
@ -133,7 +133,7 @@ function mcp_topic_view($id, $mode, $action, $url)
|
||||
'MESSAGE' => $message,
|
||||
'POST_ID' => $row['post_id'],
|
||||
|
||||
'POST_ICON_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['is_registered']) ? $user->img('icon_post_new', $user->lang['NEW_POST']) : $user->img('icon_post', $user->lang['POST']),
|
||||
'MINI_POST_IMG' => ($row['post_time'] > $user->data['user_lastvisit'] && $user->data['is_registered']) ? $user->img('icon_post_new', $user->lang['NEW_POST']) : $user->img('icon_post', $user->lang['POST']),
|
||||
|
||||
'S_CHECKBOX' => $s_checkbox,
|
||||
'S_POST_REPORTED' => ($row['post_reported']) ? true : false,
|
||||
|
@ -126,7 +126,6 @@ class template
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Load a compiled template if possible, if not, recompile it
|
||||
function _tpl_load(&$handle)
|
||||
{
|
||||
@ -265,18 +264,47 @@ class template
|
||||
$str = &$str[sizeof($str) - 1];
|
||||
}
|
||||
|
||||
$vararray['S_ROW_COUNT'] = sizeof($str[$blocks[$blockcount]]);
|
||||
|
||||
// Assign S_FIRST_ROW
|
||||
if (sizeof($str[$blocks[$blockcount]]) == 0)
|
||||
{
|
||||
$vararray['S_FIRST_ROW'] = true;
|
||||
}
|
||||
|
||||
// Now the tricky part, we always assign S_LAST_ROW and remove the entry before
|
||||
// This is much more clever than going through the complete template data on display (phew)
|
||||
$vararray['S_LAST_ROW'] = true;
|
||||
if (sizeof($str[$blocks[$blockcount]]) > 0)
|
||||
{
|
||||
unset($str[$blocks[$blockcount]][sizeof($str[$blocks[$blockcount]]) - 1]['S_LAST_ROW']);
|
||||
}
|
||||
|
||||
// Now we add the block that we're actually assigning to.
|
||||
// We're adding a new iteration to this block with the given
|
||||
// variable assignments.
|
||||
$vararray['S_ROW_COUNT'] = sizeof($str[$blocks[$blockcount]]);
|
||||
$str[$blocks[$blockcount]][] = &$vararray;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Top-level block.
|
||||
$vararray['S_ROW_COUNT'] = sizeof($this->_tpldata[$blockname]);
|
||||
|
||||
// Assign S_FIRST_ROW
|
||||
if (sizeof($this->_tpldata[$blockname]) == 0)
|
||||
{
|
||||
$vararray['S_FIRST_ROW'] = true;
|
||||
}
|
||||
|
||||
// We always assign S_LAST_ROW and remove the entry before
|
||||
$vararray['S_LAST_ROW'] = true;
|
||||
if (sizeof($this->_tpldata[$blockname]) > 0)
|
||||
{
|
||||
unset($this->_tpldata[$blockname][sizeof($this->_tpldata[$blockname]) - 1]['S_LAST_ROW']);
|
||||
}
|
||||
|
||||
// Add a new iteration to this block with the variable assignments
|
||||
// we were given.
|
||||
$vararray['S_ROW_COUNT'] = sizeof($this->_tpldata[$blockname]);
|
||||
$this->_tpldata[$blockname][] = &$vararray;
|
||||
}
|
||||
|
||||
|
@ -710,7 +710,9 @@ if ($search_keywords || $search_author || $search_id)
|
||||
|
||||
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '',
|
||||
|
||||
'S_TOPIC_TYPE' => $row['topic_type'],
|
||||
|
@ -104,7 +104,7 @@
|
||||
<td class="gensmall" nowrap="nowrap"> <b><a style="color:red" href="{postrow.U_MCP_REPORT}">{L_POST_REPORTED}</a></b> </td>
|
||||
<!-- ENDIF -->
|
||||
<td width="100%"> </td>
|
||||
<td width="10" nowrap="nowrap">{postrow.POST_ICON_IMG}</td>
|
||||
<td width="10" nowrap="nowrap">{postrow.MINI_POST_IMG}</td>
|
||||
<td class="gensmall" nowrap="nowrap"><b>{L_POSTED}:</b> {postrow.POST_DATE}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -30,7 +30,11 @@
|
||||
<!-- BEGIN searchresults -->
|
||||
<tr valign="middle">
|
||||
<td class="row1" width="25" align="center">{searchresults.TOPIC_FOLDER_IMG}</td>
|
||||
<td class="row1" width="25" align="center">{searchresults.TOPIC_ICON_IMG}</td>
|
||||
<td class="row1" width="25" align="center">
|
||||
<!-- IF {searchresults.TOPIC_ICON_IMG} -->
|
||||
<img src="{T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}" width="{searchresults.TOPIC_ICON_IMG_WIDTH}" height="{searchresults.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" />
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td class="row1">
|
||||
<!-- IF searchresults.S_TOPIC_UNAPPROVED -->
|
||||
<a href="{topicrow.U_MCP_QUEUE}">{UNAPPROVED_IMG}</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
<tr>
|
||||
<td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td>
|
||||
<!-- IF S_TOPIC_ICONS -->
|
||||
<td class="row1" width="25" align="center">{topicrow.TOPIC_ICON_IMG}</td>
|
||||
<td class="row1" width="25" align="center"><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED -->
|
||||
@ -158,7 +158,7 @@
|
||||
<tr>
|
||||
<td class="row1" width="25" align="center">{topicrow.TOPIC_FOLDER_IMG}</td>
|
||||
<!-- IF S_TOPIC_ICONS -->
|
||||
<td class="row1" width="25" align="center">{topicrow.TOPIC_ICON_IMG}</td>
|
||||
<td class="row1" width="25" align="center"><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED -->
|
||||
|
@ -129,7 +129,7 @@
|
||||
<td width="100%" height="25"><table width="100%" cellspacing="0">
|
||||
<tr>
|
||||
<!-- IF postrow.POST_ICON_IMG -->
|
||||
<td>{postrow.POST_ICON_IMG}</td>
|
||||
<td><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" title="" /></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="gensmall" width="100%"><div style="float:left"> <b>{L_POST_SUBJECT}:</b> {postrow.POST_SUBJECT}</div><div style="float:right"><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><b>{L_POSTED}:</b> {postrow.POST_DATE} </div></td>
|
||||
</tr>
|
||||
|
@ -446,7 +446,9 @@ if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)
|
||||
'LAST_POST_IMG' => $user->img('icon_post_latest', 'VIEW_LATEST_POST'),
|
||||
'NEWEST_POST_IMG' => $newest_post_img,
|
||||
'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt),
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
|
||||
'ATTACH_ICON_IMG' => ($auth->acl_gets('f_download', 'u_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_attach', sprintf($user->lang['TOTAL_ATTACHMENTS'], $row['topic_attachment'])) : '',
|
||||
|
||||
'S_TOPIC_TYPE' => $row['topic_type'],
|
||||
|
@ -1251,8 +1251,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||
'EDIT_REASON' => $row['post_edit_reason'],
|
||||
'BUMPED_MESSAGE'=> $l_bumped_by,
|
||||
|
||||
'MINI_POST_IMG' => ($user->data['is_registered'] && $row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? $user->img('icon_post_new', 'NEW_POST') : $user->img('icon_post', 'POST'),
|
||||
'POST_ICON_IMG' => (!empty($row['icon_id'])) ? '<img src="' . $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] . '" width="' . $icons[$row['icon_id']]['width'] . '" height="' . $icons[$row['icon_id']]['height'] . '" alt="" title="" />' : '',
|
||||
'MINI_POST_IMG' => ($user->data['is_registered'] && $row['post_time'] > $user->data['user_lastvisit'] && $row['post_time'] > $topic_last_read) ? $user->img('icon_post_new', 'NEW_POST') : $user->img('icon_post', 'POST'),
|
||||
'POST_ICON_IMG' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
|
||||
'POST_ICON_IMG_WIDTH' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
|
||||
'POST_ICON_IMG_HEIGHT' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
|
||||
'ICQ_STATUS_IMG' => $user_cache[$poster_id]['icq_status_img'],
|
||||
'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('btn_online', 'ONLINE') : $user->img('btn_offline', 'OFFLINE')),
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user