Simple little snippet, made from a request by [url=http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=356834]ameisez[/url] in [url=http://www.phpbb.com/community/viewtopic.php?f=72&t=1208685]this topic[/url].
As the title suggests, this is a list of all the smilies installed on your forum. I've included pagination to save a bit of load. I know some forums have 100's of smilies. The default is set by whatever your topics per page setting is (this is set somewhere in the ACP )
smilies.php
Code: Select all
<?php
/**
*
* @package Smilies List
* @version $Id: smilies.php, 0009 02:26 07/12/2008 cherokee red Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mods/smilies_list');
$start = request_var('start', 0);
// We don't have any params at the moment, but they can easily be added in here
// See this wiki for more details - http://wiki.phpbb.com/Generate_pagination
$check_params = array();
$params = array();
foreach ($check_params as $key => $default)
{
if (!isset($_REQUEST[$key]))
{
continue;
}
$param = call_user_func('request_var', $key, $default);
$$key = $param;
$params[] = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);
}
$pagination_url = append_sid($phpbb_root_path . 'smilies.' . $phpEx, implode('&', $params));
// How many smilies do we have?
$sql = 'SELECT COUNT(smiley_id) AS total_smilies
FROM ' . SMILIES_TABLE . '
ORDER BY smiley_id';
$result = $db->sql_query($sql);
$total_smilies = (int) $db->sql_fetchfield('total_smilies');
$db->sql_freeresult($result);
//Pull smilies from the database
$sql = 'SELECT *
FROM ' . SMILIES_TABLE . '
ORDER BY smiley_id';
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
while ($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('smilies', array(
'SMILEY_ID' => $row['smiley_id'],
'A_SMILEY_CODE' => addslashes($row['code']),
'SMILEY_IMG' => $phpbb_root_path . $config['smilies_path'] . '/' . $row['smiley_url'],
'SMILEY_CODE' => $row['code'],
'SMILEY_DESC' => $row['emotion'],
'SMILEY_WIDTH' => $row['smiley_width'],
'SMILEY_HEIGHT' => $row['smiley_height'],
));
}
$db->sql_freeresult($result);
$l_title = $user->lang['SMILIES_TITLE'];
$template->assign_vars(array(
'PAGINATION' => generate_pagination($pagination_url, $total_smilies, $config['topics_per_page'], $start, true),
'PAGE_NUMBER' => on_page($total_smilies, $config['topics_per_page'], $start),
'TOTAL_SMILIES' => ($total_smilies == 1) ? $user->lang['SMILEY_COUNT'] : sprintf($user->lang['SMILIES_COUNT'], $total_smilies),
));
// Output page
page_header($l_title);
// Set up the Navlinks for the forums navbar
$template->assign_block_vars('navlinks', array(
'FORUM_NAME' => $user->lang['SMILIES_TITLE'],
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}smilies.$phpEx"))
);
$template->set_filenames(array(
'body' => 'smilies_body.html')
);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
language/en/mods/smilies_list.php
Code: Select all
<?php
/**
*
*
* @package language
* @version $Id: smilies_list.php 0004 22:49 25/09/2008 cherokee red $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
// Smilies List
$lang = array_merge($lang, array(
'NO_SMILIES' => 'There are currently no smilies installed on this forum.',
'SMILIES_TITLE' => 'Smilies List',
'SMILEY_ID' => '#',
'SMILEY_CODE' => 'Smiley Code',
'SMILEY_IMG' => 'Smiley Image',
'SMILEY_DESC' => 'Smiley Emotion',
'SMILIEY_COUNT' => '1 smiley',
'SMILIES_COUNT' => '%d smilies',
));
?>
styles/prosilver/template/smilies_body.html
Code: Select all
<!-- INCLUDE overall_header.html -->
<h2>{L_SMILIES_TITLE}</h2>
<!-- IF PAGINATION or TOTAL_SMILIES -->
<div class="pagination">
{TOTAL_SMILIES}<!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> • <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • <span>{PAGINATION}</span><!-- ELSE --> • {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
</div>
<!-- ENDIF -->
<div class="clear"></div>
<br />
<div class="forumbg forumbg-table">
<div class="inner"><span class="corners-top"><span></span></span>
<!-- Smilies Listr -->
<table class="table1" cellspacing="1">
<thead>
<tr>
<th class="table1" style="text-align:center;">{L_SMILEY_ID}</th>
<th class="table1" style="text-align:center;">{L_SMILEY_CODE}</th>
<th class="table1" style="text-align:center;">{L_SMILEY_DESC}</th>
<th class="table1" style="text-align:center;">{L_SMILEY_IMG}</th>
</tr>
</thead>
<tbody>
<!-- IF .smilies -->
<!-- BEGIN smilies -->
<tr class="<!-- IF smilies.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
<td style="text-align:center;">{smilies.SMILEY_ID}</td>
<td style="text-align:center;">{smilies.SMILEY_CODE}</td>
<td style="text-align:center;">{smilies.SMILEY_DESC}</td>
<td style="text-align:center;"><img src="{smilies.SMILEY_IMG}" width="{smilies.SMILEY_WIDTH}" height="{smilies.SMILEY_HEIGHT}" alt="{smilies.SMILEY_CODE}" title="{smilies.SMILEY_DESC}" /></td>
</tr>
<!-- END smilies -->
</tbody>
</table>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ELSE -->
</tbody>
</table>
<span class="corners-bottom"><span></span></span></div>
</div>
<div class="errorbox">
<br />
<p><strong>{L_NO_SMILIES}</strong></p>
<br />
</div>
<br />
<!-- ENDIF -->
<!-- IF PAGINATION or TOTAL_SMILIES -->
<div class="pagination">
{TOTAL_SMILIES}<!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> • <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • <span>{PAGINATION}</span><!-- ELSE --> • {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
</div>
<!-- ENDIF -->
<!-- Smilies List -->
<br /><br />
<!-- INCLUDE overall_footer.html -->