TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 05:53:29 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,106
  • Total Topics: 21,213
  • Online today: 358
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 311
  • Total: 312
  • @rjen

Hooking: Pages by Tag for TinyPortal

Started by kohai.raul, June 12, 2015, 07:12:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kohai.raul

Hi all!

My first posts on this site was:

http://wwwDOTtinyportalDOTnet/index.php?topic=35451.0
http://wwwDOTtinyportalDOTnet/index.php?topic=35452

I had no answers for my questions, so I decided somehow try to solve my needs, without really knowing if what I've done was necessary (or not).

Into this post (and future answers), I will share the solution that I found... I'm sorry, I've not experience as smf developer but tried to follow some guide. ;-)

=== DESCRIPTION ====

1) A new hooked action "tagpage" allows a list of themes/posts for an specific Tag, responding to the following URL format:

mydomainDOTcom/?action=tagpage;tn=tagname

2) A php snippet allows to show a cloud of linkable tags.

Then, it allows to use the simple tag's system of TinyPortal with this little enhancement, offering the possibility to have a cloud of linkable tags, and result pages for each tag (as "Recents" page layout).

see you onto next answer... soon ;-)

Regards, 

kohai.raul

$root/add_action_hook.php

<?php
// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

add_integration_function('integrate_pre_include''$sourcedir/Subs-TagPage.php');
add_integration_function('integrate_actions''tagpage_add_hook');
?>

kohai.raul

$Sources/Subs-TagPage.php

<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
tagpage_add_hook(&$actionArray)
{
$actionArray['tagpage'] = array('TagPage.php''TagPageMain');
}

?>

kohai.raul

$Sources/TagPage.php

<?php

/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */

if (!defined('SMF'))
die('Hacking attempt...');

/*


@developer Raul Cruz Carmona http://www.fuentedepermacultura.org
@mail-to  raul@fuentedepermacultura.org

This file had one very clear purpose.  It is here expressly to enhance the tags system of tinyPortal (a bit more...).
This mod bring us the functionality to have page results (for posts) from any tag. The result page is the same as Recents page

A linkable tag can have the following url
mydomain.com/?action=tagpage;tn=tagname

if you need to know how to get a cloud of linkable tags for tiny portal, please email me to raul@fuentedepermacultura.org 

void TagPageMain()
// !!!

*/

function TagPageMain()
{
global $txt$scripturl$user_info$context$modSettings$sourcedir$board$smcFunc;


loadTemplate('TagPage');

$context['page_title'] = $txt['TagPage_title'];

if (isset($_REQUEST['start']) && $_REQUEST['start'] > 95)
$_REQUEST['start'] = 95;

$query_parameters = array();


if (!empty($_REQUEST['tn']))
{

$context['page_title'] = $context['page_title'].$_REQUEST['tn'];

//Consultamos la lista de topics registradas en el sistema de tags
$prequery='SELECT value1 AS topicstring, t.subtype AS tag
FROM {db_prefix}tp_variables AS t 
WHERE t.type = \'globaltag_item\'  
AND t.value3=\'tpadmin_topictags\'
AND t.subtype = \''
.$_REQUEST['tn'].'\' ';

$resultTagPosts $smcFunc['db_query'](''$prequery,NULL);

//extraemos los id de los posts contenidos en topicstring, con el formato ?topic=*.0
$topics = array();
$patterns = array("?topic="".0");
$substitute='';
while ($row $smcFunc['db_fetch_assoc']($resultTagPosts))
{
$topics[] = str_replace($patterns,$substitute,$row['topicstring']);
}

//Completamos el titulo de la página con el nº de resultados encontrados

$context['page_title'] = $context['page_title'].$txt['TagPage_title_count_before'].count($topics).$txt['TagPage_title_count_after'];

$smcFunc['db_free_result']($resultTagPosts);

$context['page_index'] = constructPageIndex($scripturl '?action=tagpage;tn=' implode(','$_REQUEST['tn']), $_REQUEST['start'], min(100$total_cat_posts), 10false);

}

$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));

// Si no se han obtenido resultados, retornamos...
if (empty($topics))
{
$context['posts'] = array();
return;
}



//Recuperamos los temas asociados al Tag, según lista de topics
$request $smcFunc['db_query']('''
SELECT
m.id_msg, m.subject, m.smileys_enabled, m.poster_time, m.body, m.id_topic, t.id_board, b.id_cat,
b.name AS bname, c.name AS cname, t.num_replies, m.id_member, m2.id_member AS id_first_member,
IFNULL(mem2.real_name, m2.poster_name) AS first_poster_name, t.id_first_msg,
IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_last_msg
FROM {db_prefix}messages AS m
INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
INNER JOIN {db_prefix}messages AS m2 ON (m2.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}members AS mem2 ON (mem2.id_member = m2.id_member)
WHERE m.id_msg IN ({array_int:message_list})
ORDER BY m.id_msg DESC
LIMIT ' 
count($topics),
array(
'message_list' => $topics,
)
);
$counter $_REQUEST['start'] + 1;
$context['posts'] = array();
$board_ids = array('own' => array(), 'any' => array());

while ($row $smcFunc['db_fetch_assoc']($request))
{
// Censor everything.
censorText($row['body']);
censorText($row['subject']);

// BBC-atize the message.
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);

// And build the array.
$context['posts'][$row['id_msg']] = array(
'id' => $row['id_msg'],
'counter' => $counter++,
'alternate' => $counter 2,
'category' => array(
'id' => $row['id_cat'],
'name' => $row['cname'],
'href' => $scripturl '#c' $row['id_cat'],
'link' => '<a href="' $scripturl '#c' $row['id_cat'] . '">' $row['cname'] . '</a>'
),
'board' => array(
'id' => $row['id_board'],
'name' => $row['bname'],
'href' => $scripturl '?board=' $row['id_board'] . '.0',
'link' => '<a href="' $scripturl '?board=' $row['id_board'] . '.0">' $row['bname'] . '</a>'
),
'topic' => $row['id_topic'],
'href' => $scripturl '?topic=' $row['id_topic'] . '.msg' $row['id_msg'] . '#msg' $row['id_msg'],
'link' => '<a href="' $scripturl '?topic=' $row['id_topic'] . '.msg' $row['id_msg'] . '#msg' $row['id_msg'] . '" rel="nofollow">' $row['subject'] . '</a>',
'start' => $row['num_replies'],
'subject' => $row['subject'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true$row['poster_time']),
'first_poster' => array(
'id' => $row['id_first_member'],
'name' => $row['first_poster_name'],
'href' => empty($row['id_first_member']) ? '' $scripturl '?action=profile;u=' $row['id_first_member'],
'link' => empty($row['id_first_member']) ? $row['first_poster_name'] : '<a href="' $scripturl '?action=profile;u=' $row['id_first_member'] . '">' $row['first_poster_name'] . '</a>'
),
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' $scripturl '?action=profile;u=' $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' $scripturl '?action=profile;u=' $row['id_member'] . '">' $row['poster_name'] . '</a>'
),
'message' => $row['body'],
'can_reply' => false,
'can_mark_notify' => false,
'can_delete' => false,
'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()),
);

if ($user_info['id'] == $row['id_first_member'])
$board_ids['own'][$row['id_board']][] = $row['id_msg'];
$board_ids['any'][$row['id_board']][] = $row['id_msg'];
}
$smcFunc['db_free_result']($request);

// There might be - and are - different permissions between any and own.
$permissions = array(
'own' => array(
'post_reply_own' => 'can_reply',
'delete_own' => 'can_delete',
),
'any' => array(
'post_reply_any' => 'can_reply',
'mark_any_notify' => 'can_mark_notify',
'delete_any' => 'can_delete',
)
);

// Now go through all the permissions, looking for boards they can do it on.
foreach ($permissions as $type => $list)
{
foreach ($list as $permission => $allowed)
{
// They can do it on these boards...
$boards boardsAllowedTo($permission);

// If 0 is the only thing in the array, they can do it everywhere!
if (!empty($boards) && $boards[0] == 0)
$boards array_keys($board_ids[$type]);

// Go through the boards, and look for posts they can do this on.
foreach ($boards as $board_id)
{
// Hmm, they have permission, but there are no topics from that board on this page.
if (!isset($board_ids[$type][$board_id]))
continue;

// Okay, looks like they can do it for these posts.
foreach ($board_ids[$type][$board_id] as $counter)
if ($type == 'any' || $context['posts'][$counter]['poster']['id'] == $user_info['id'])
$context['posts'][$counter][$allowed] = true;
}
}
}

$quote_enabled = empty($modSettings['disabledBBC']) || !in_array('quote'explode(','$modSettings['disabledBBC']));
foreach ($context['posts'] as $counter => $dummy)
{
// Some posts - the first posts - can't just be deleted.
$context['posts'][$counter]['can_delete'] &= $context['posts'][$counter]['delete_possible'];

// And some cannot be quoted...
$context['posts'][$counter]['can_quote'] = $context['posts'][$counter]['can_reply'] && $quote_enabled;
}

}


?>

kohai.raul

$defaultTheme/TagPage.template.php

<?php
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0
 */

function template_main()
{
global $context$settings$options$txt$scripturl;

echo '<div id="recent" class="main_section">
<div class="cat_bar">
<h3 class="catbg">
<span class="ie6_header floatleft"><img src="'
$settings['images_url'], '/post/xx.gif" alt="" class="icon" />',$context['page_title'],'</span>
</h3>
</div>
<div class="pagesection">
<span>'
$txt['pages'], ': '$context['page_index'], '</span>
</div>'
;

foreach ($context['posts'] as $post)
{
echo '
<div class="'
$post['alternate'] == 'windowbg' 'windowbg2'' core_posts">
<span class="topslice"><span></span></span>
<div class="content">
<div class="counter">'
$post['counter'], '</div>
<div class="topic_details">
<h5>'
$post['board']['link'], ' / '$post['link'], '</h5>
<span class="smalltext">«&nbsp;'
$txt['last_post'], ' '$txt['by'], ' <strong>'$post['poster']['link'], ' </strong> '$txt['on'], '<em> '$post['time'], '</em>&nbsp;»</span>
</div>
<div class="list_posts">'
$post['message'], '</div>
</div>'
;

if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
echo '
<div class="quickbuttons_wrap">
<ul class="reset smalltext quickbuttons">'
;

// If they *can* reply?
if ($post['can_reply'])
echo '
<li class="reply_button"><a href="'
$scripturl'?action=post;topic='$post['topic'], '.'$post['start'], '"><span>'$txt['reply'], '</span></a></li>';

// If they *can* quote?
if ($post['can_quote'])
echo '
<li class="quote_button"><a href="'
$scripturl'?action=post;topic='$post['topic'], '.'$post['start'], ';quote='$post['id'], '"><span>'$txt['quote'], '</span></a></li>';

// Can we request notification of topics?
if ($post['can_mark_notify'])
echo '
<li class="notify_button"><a href="'
$scripturl'?action=notify;topic='$post['topic'], '.'$post['start'], '"><span>'$txt['notify'], '</span></a></li>';

// How about... even... remove it entirely?!
if ($post['can_delete'])
echo '
<li class="remove_button"><a href="'
$scripturl'?action=deletemsg;msg='$post['id'], ';topic='$post['topic'], ';recent;'$context['session_var'], '='$context['session_id'], '" onclick="return confirm(\''$txt['remove_message'], '?\');"><span>'$txt['remove'], '</span></a></li>';

if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
echo '
</ul>
</div>'
;

echo '
<span class="botslice clear"><span></span></span>
</div>'
;

}

echo '
<div class="pagesection">
<span>'
$txt['pages'], ': '$context['page_index'], '</span>
</div>
</div>'
;
}

function 
template_unread()
{
global $context$settings$options$txt$scripturl$modSettings;

echo '
<div id="recent" class="main_content">'
;

$showCheckboxes = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == && $settings['show_mark_read'];

if ($showCheckboxes)
echo '
<form action="'
$scripturl'?action=quickmod" method="post" accept-charset="'$context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;">
<input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" />
<input type="hidden" name="qaction" value="markread" />
<input type="hidden" name="redirect_url" value="action=unread'
, (!empty($context['showing_all_topics']) ? ';all' ''), $context['querystring_board_limits'], '" />';

if ($settings['show_mark_read'])
{
// Generate the button strip.
$mark_read = array(
'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' 'mark_read_short''image' => 'markread.gif''lang' => true'url' => $scripturl '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' 'board' $context['querystring_board_limits']) . ';' $context['session_var'] . '=' $context['session_id']),
);

if ($showCheckboxes)
$mark_read['markselectread'] = array(
'text' => 'quick_mod_markread',
'image' => 'markselectedread.gif',
'lang' => true,
'url' => 'javascript:document.quickModForm.submit();',
);
}

if (!empty($context['topics']))
{
echo '
<div class="pagesection">'
;

if (!empty($mark_read) && !empty($settings['use_tabs']))
template_button_strip($mark_read'right');

echo '
<span>'
$txt['pages'], ': '$context['page_index'], '</span>
</div>'
;

echo '
<div class="tborder topic_table" id="unread">
<table class="table_grid" cellspacing="0">
<thead>
<tr class="catbg">
<th scope="col" class="first_th" width="8%" colspan="2">&nbsp;</th>
<th scope="col">
<a href="'
$scripturl'?action=unread'$context['showing_all_topics'] ? ';all' ''$context['querystring_board_limits'], ';sort=subject'$context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ';desc' '''">'$txt['subject'], $context['sort_by'] == 'subject' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>
<th scope="col" width="14%" align="center">
<a href="'
$scripturl'?action=unread'$context['showing_all_topics'] ? ';all' ''$context['querystring_board_limits'], ';sort=replies'$context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ';desc' '''">'$txt['replies'], $context['sort_by'] == 'replies' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>'
;

// Show a "select all" box for quick moderation?
if ($showCheckboxes)
echo '
<th scope="col" width="22%">
<a href="'
$scripturl'?action=unread'$context['showing_all_topics'] ? ';all' ''$context['querystring_board_limits'], ';sort=last_post'$context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ';desc' '''">'$txt['last_post'], $context['sort_by'] == 'last_post' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>
<th class="last_th">
<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
</th>'
;
else
echo '
<th scope="col" class="smalltext last_th" width="22%">
<a href="'
$scripturl'?action=unread'$context['showing_all_topics'] ? ';all' ''$context['querystring_board_limits'], ';sort=last_post'$context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ';desc' '''">'$txt['last_post'], $context['sort_by'] == 'last_post' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>'
;
echo '
</tr>
</thead>
<tbody>'
;

foreach ($context['topics'] as $topic)
{
// Calculate the color class of the topic.
$color_class '';
if (strpos($topic['class'], 'sticky') !== false)
$color_class 'stickybg';
if (strpos($topic['class'], 'locked') !== false)
$color_class .= 'lockedbg';

$color_class2 = !empty($color_class) ? $color_class '2' '';

echo '
<tr>
<td class="'
$color_class' icon1 windowbg">
<img src="'
$settings['images_url'], '/topic/'$topic['class'], '.gif" alt="" />
</td>
<td class="'
$color_class' icon2 windowbg">
<img src="'
$topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="subject '
$color_class2' windowbg2">
<div>
'
$topic['is_sticky'] ? '<strong>' '''<span id="msg_' $topic['first_post']['id'] . '">'$topic['first_post']['link'], '</span>'$topic['is_sticky'] ? '</strong>' '''
<a href="'
$topic['new_href'], '" id="newicon'$topic['first_post']['id'], '"><img src="'$settings['lang_images_url'], '/new.gif" alt="'$txt['new'], '" /></a>
<p>
'
$txt['started_by'], ' <strong>'$topic['first_post']['member']['link'], '</strong>
'
$txt['in'], ' <em>'$topic['board']['link'], '</em>
<small id="pages'
$topic['first_post']['id'], '">'$topic['pages'], '</small>
</p>
</div>
</td>
<td class="'
$color_class' stats windowbg">
'
$topic['replies'], ' '$txt['replies'], '
<br />
'
$topic['views'], ' '$txt['views'], '
</td>
<td class="'
$color_class2' lastpost windowbg2">
<a href="'
$topic['last_post']['href'], '"><img src="'$settings['images_url'], '/icons/last_post.gif" alt="'$txt['last_post'], '" title="'$txt['last_post'], '" style="float: right;" /></a>
'
$topic['last_post']['time'], '<br />
'
$txt['by'], ' '$topic['last_post']['member']['link'], '
</td>'
;

if ($showCheckboxes)
echo '
<td class="windowbg2" valign="middle" align="center">
<input type="checkbox" name="topics[]" value="'
$topic['id'], '" class="input_check" />
</td>'
;
echo '
</tr>'
;
}

if (!empty($context['topics']) && !$context['showing_all_topics'])
$mark_read['readall'] = array('text' => 'unread_topics_all''image' => 'markreadall.gif''lang' => true'url' => $scripturl '?action=unread;all' $context['querystring_board_limits'], 'active' => true);

if (empty($settings['use_tabs']) && !empty($mark_read))
echo '
<tr class="catbg">
<td colspan="'
$showCheckboxes '6' '5''" align="right">
'
template_button_strip($mark_read'top'), '
</td>
</tr>'
;

if (empty($context['topics']))
echo '
<tr style="display: none;"><td></td></tr>'
;

echo '
</tbody>
</table>
</div>
<div class="pagesection" id="readbuttons">'
;

if (!empty($settings['use_tabs']) && !empty($mark_read))
template_button_strip($mark_read'right');

echo '
<span>'
$txt['pages'], ': '$context['page_index'], '</span>
</div>'
;
}
else
echo '
<div class="cat_bar">
<h3 class="catbg centertext">
'
$context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], '
</h3>
</div>'
;

if ($showCheckboxes)
echo '
</form>'
;

echo '
<div class="description " id="topic_icons">
<p class="smalltext floatleft">
'
, !empty($modSettings['enableParticipation']) ? '
<img src="' 
$settings['images_url'] . '/topic/my_normal_post.gif" alt="" align="middle" /> ' $txt['participation_caption'] . '<br />' '''
<img src="'
$settings['images_url'], '/topic/normal_post.gif" alt="" align="middle" /> '$txt['normal_topic'], '<br />
<img src="'
$settings['images_url'], '/topic/hot_post.gif" alt="" align="middle" /> 'sprintf($txt['hot_topics'], $modSettings['hotTopicPosts']), '<br />
<img src="'
$settings['images_url'], '/topic/veryhot_post.gif" alt="" align="middle" /> 'sprintf($txt['very_hot_topics'], $modSettings['hotTopicVeryPosts']), '
</p>
<p class="smalltext para2">
<img src="'
$settings['images_url'], '/icons/quick_lock.gif" alt="" align="middle" /> '$txt['locked_topic'], '<br />', ($modSettings['enableStickyTopics'] == '1' '
<img src="' 
$settings['images_url'] . '/icons/quick_sticky.gif" alt="" align="middle" /> ' $txt['sticky_topic'] . '<br />' ''), ($modSettings['pollMode'] == '1' '
<img src="' 
$settings['images_url'] . '/topic/normal_poll.gif" alt="" align="middle" /> ' $txt['poll'] : ''), '
</p>
</div>
</div>'
;
}

function 
template_replies()
{
global $context$settings$options$txt$scripturl$modSettings;

echo '
<div id="recent">'
;

$showCheckboxes = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == && $settings['show_mark_read'];

if ($showCheckboxes)
echo '
<form action="'
$scripturl'?action=quickmod" method="post" accept-charset="'$context['character_set'], '" name="quickModForm" id="quickModForm" style="margin: 0;">
<input type="hidden" name="'
$context['session_var'], '" value="'$context['session_id'], '" />
<input type="hidden" name="qaction" value="markread" />
<input type="hidden" name="redirect_url" value="action=unreadreplies'
, (!empty($context['showing_all_topics']) ? ';all' ''), $context['querystring_board_limits'], '" />';

if (isset($context['topics_to_mark']) && !empty($settings['show_mark_read']))
{
// Generate the button strip.
$mark_read = array(
'markread' => array('text' => 'mark_as_read''image' => 'markread.gif''lang' => true'url' => $scripturl '?action=markasread;sa=unreadreplies;topics=' $context['topics_to_mark'] . ';' $context['session_var'] . '=' $context['session_id']),
);

if ($showCheckboxes)
$mark_read['markselectread'] = array(
'text' => 'quick_mod_markread',
'image' => 'markselectedread.gif',
'lang' => true,
'url' => 'javascript:document.quickModForm.submit();',
);
}

if (!empty($context['topics']))
{
echo '
<div class="pagesection">'
;

if (!empty($mark_read) && !empty($settings['use_tabs']))
template_button_strip($mark_read'right');

echo '
<span>'
$txt['pages'], ': '$context['page_index'], '</span>
</div>'
;

echo '
<div class="tborder topic_table" id="unreadreplies">
<table class="table_grid" cellspacing="0">
<thead>
<tr class="catbg">
<th scope="col" class="first_th" width="8%" colspan="2">&nbsp;</th>
<th scope="col">
<a href="'
$scripturl'?action=unreadreplies'$context['querystring_board_limits'], ';sort=subject'$context['sort_by'] === 'subject' && $context['sort_direction'] === 'up' ';desc' '''">'$txt['subject'], $context['sort_by'] === 'subject' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>
<th scope="col" width="14%" align="center">
<a href="'
$scripturl'?action=unreadreplies'$context['querystring_board_limits'], ';sort=replies'$context['sort_by'] === 'replies' && $context['sort_direction'] === 'up' ';desc' '''">'$txt['replies'], $context['sort_by'] === 'replies' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>'
;

// Show a "select all" box for quick moderation?
if ($showCheckboxes)
echo '
<th scope="col" width="22%">
<a href="'
$scripturl'?action=unreadreplies'$context['querystring_board_limits'], ';sort=last_post'$context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ';desc' '''">'$txt['last_post'], $context['sort_by'] === 'last_post' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>
<th class="last_th">
<input type="checkbox" onclick="invertAll(this, this.form, \'topics[]\');" class="input_check" />
</th>'
;
else
echo '
<th scope="col" class="last_th" width="22%">
<a href="'
$scripturl'?action=unreadreplies'$context['querystring_board_limits'], ';sort=last_post'$context['sort_by'] === 'last_post' && $context['sort_direction'] === 'up' ';desc' '''">'$txt['last_post'], $context['sort_by'] === 'last_post' ' <img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" />' '''</a>
</th>'
;
echo '
</tr>
</thead>
<tbody>'
;

foreach ($context['topics'] as $topic)
{
// Calculate the color class of the topic.
$color_class '';
if (strpos($topic['class'], 'sticky') !== false)
$color_class 'stickybg';
if (strpos($topic['class'], 'locked') !== false)
$color_class .= 'lockedbg';

$color_class2 = !empty($color_class) ? $color_class '2' '';

echo '
<tr>
<td class="'
$color_class' icon1 windowbg">
<img src="'
$settings['images_url'], '/topic/'$topic['class'], '.gif" alt="" />
</td>
<td class="'
$color_class' icon2 windowbg">
<img src="'
$topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="subject '
$color_class2' windowbg2">
<div>
'
$topic['is_sticky'] ? '<strong>' '''<span id="msg_' $topic['first_post']['id'] . '">'$topic['first_post']['link'], '</span>'$topic['is_sticky'] ? '</strong>' '''
<a href="'
$topic['new_href'], '" id="newicon'$topic['first_post']['id'], '"><img src="'$settings['lang_images_url'], '/new.gif" alt="'$txt['new'], '" /></a>
<p>
'
$txt['started_by'], ' <strong>'$topic['first_post']['member']['link'], '</strong>
'
$txt['in'], ' <em>'$topic['board']['link'], '</em>
<small id="pages'
$topic['first_post']['id'], '">'$topic['pages'], '</small>
</p>
</div>
</td>
<td class="'
$color_class' stats windowbg">
'
$topic['replies'], ' '$txt['replies'], '
<br />
'
$topic['views'], ' '$txt['views'], '
</td>
<td class="'
$color_class2' lastpost windowbg2">
<a href="'
$topic['last_post']['href'], '"><img src="'$settings['images_url'], '/icons/last_post.gif" alt="'$txt['last_post'], '" title="'$txt['last_post'], '" style="float: right;" /></a>
'
$topic['last_post']['time'], '<br />
'
$txt['by'], ' '$topic['last_post']['member']['link'], '
</td>'
;

if ($showCheckboxes)
echo '
<td class="windowbg2" valign="middle" align="center">
<input type="checkbox" name="topics[]" value="'
$topic['id'], '" class="input_check" />
</td>'
;
echo '
</tr>'
;
}

if (empty($settings['use_tabs']) && !empty($mark_read))
echo '
<tr class="catbg">
<td colspan="'
$showCheckboxes '6' '5''" align="right">
'
template_button_strip($mark_read'top'), '
</td>
</tr>'
;

echo '
</tbody>
</table>
</div>
<div class="pagesection">'
;

if (!empty($settings['use_tabs']) && !empty($mark_read))
template_button_strip($mark_read'right');

echo '
<span>'
$txt['pages'], ': '$context['page_index'], '</span>
</div>'
;
}
else
echo '
<div class="cat_bar">
<h3 class="catbg centertext">
'
$context['showing_all_topics'] ? $txt['msg_alert_none'] : $txt['unread_topics_visit_none'], '
</h3>
</div>'
;

if ($showCheckboxes)
echo '
</form>'
;

echo '
<div class="description flow_auto" id="topic_icons">
<p class="smalltext floatleft">
'
, !empty($modSettings['enableParticipation']) ? '
<img src="' 
$settings['images_url'] . '/topic/my_normal_post.gif" alt="" align="middle" /> ' $txt['participation_caption'] . '<br />' '''
<img src="'
$settings['images_url'], '/topic/normal_post.gif" alt="" align="middle" /> '$txt['normal_topic'], '<br />
<img src="'
$settings['images_url'], '/topic/hot_post.gif" alt="" align="middle" /> 'sprintf($txt['hot_topics'], $modSettings['hotTopicPosts']), '<br />
<img src="'
$settings['images_url'], '/topic/veryhot_post.gif" alt="" align="middle" /> 'sprintf($txt['very_hot_topics'], $modSettings['hotTopicVeryPosts']), '
</p>
<p class="smalltext para2">
<img src="'
$settings['images_url'], '/icons/quick_lock.gif" alt="" align="middle" /> '$txt['locked_topic'], '<br />', ($modSettings['enableStickyTopics'] == '1' '
<img src="' 
$settings['images_url'] . '/icons/quick_sticky.gif" alt="" align="middle" /> ' $txt['sticky_topic'] . '<br />' '') . ($modSettings['pollMode'] == '1' '
<img src="' 
$settings['images_url'] . '/topic/normal_poll.gif" alt="" align="middle" /> ' $txt['poll'] : '') . '
</p>
</div>
</div>'
;
}

?>

kohai.raul

Add to Modifications.spanish_es.php (translation needed for alternative languages)

//TAGPAGE for TinyPortal
$txt['tagpage'] = 'Vista por Etiquetas';
$txt['TagPage'] = 'P&aacute;ginas de etiquetas para TinyPortal';
$txt['TagPage_title'] = '<strong>Etiqueta:</strong> ';
$txt['TagPage_title_count_before']=' (';
$txt['TagPage_title_count_after']=' temas localizados)';

kohai.raul

$root/remove_action_hook.php (if needed) ;-)

<?php
// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

remove_integration_function('integrate_pre_include''$sourcedir/Subs-TagPage.php');
remove_integration_function('integrate_actions''tagpage_add_hook');
?>

kohai.raul

PHP SNIPPET FOR A CLOUD OF TAGS
(onto a TinyPortal block)



global $scripturl, $smcFunc,$db_prefix,$db_connection;

$query='SELECT t.subtype AS tag, t.subtype AS idtag,COUNT(t.subtype) AS quantity
FROM {db_prefix}tp_variables AS t
WHERE t.type = \'globaltag_item\' 
AND t.value3=\'tpadmin_topictags\'
GROUP BY t.subtype
ORDER BY t.subtype
DESC LIMIT {int:limit}';

$resultTags = $smcFunc['db_query']('', $query,array('limit' => 50));

$tags = array();
$tags2 = array();

while ($row = $smcFunc['db_fetch_assoc']($resultTags))
{
$tags[$row['tag']] = $row['quantity'];
$tags2[$row['tag']] = $row['idtag'];
}


if(count($tags2) > 0)
{
// change these font sizes if you will
$max_size = 250; // max font size in %
$min_size = 100; // min font size in %

// get the largest and smallest array values
$max_qty = max(array_values($tags));
$min_qty = min(array_values($tags));

// find the range of values
$spread = $max_qty - $min_qty;
if (0 == $spread)
{ // we don't want to divide by zero
$spread = 1;
}

// determine the font-size increment
// this is the increase per tag quantity (times used)
$step = ($max_size - $min_size)/($spread);

// loop through our tag array
$poptags = '';
$row_count = 0;
foreach ($tags as $key => $value)
{
               $linkcontent="";
$row_count++;
$size = $min_size + (($value - $min_qty) * $step);
// uncomment if you want sizes in whole %:
// $size = ceil($size);

$linkcontent = 'href="' . $scripturl . '?action=tagpage;tn=' . $tags2[$key] . '" style="font-size: '.$size.'%"';
$linkcontent .= ' title="'.$value.' things tagged with '.$key.'"';
$poptags .= '<a '.$linkcontent.'>'.$key.'</a> ';
if ($row_count > 5)
{
$poptags .= '<br />';
$row_count =0;
}
}
}

echo $poptags;

mysql_free_result($resultTags);



kohai.raul

Bon Appetite!!!  ;D

I hope it's useful for more people...    O0

regards,

IchBin

Looks like you did just fine! :) Good work, and sorry for the lack of support here. Busy time of year for most people.