Can anyone help me show the list of recent topics on top of the board index instead of the info center? Tried to make the changes as I had in SMF to show the list above the boards, but it seems I made something wrong. Didn't work. :(
Manual changes or using hook?
What's better? I tried manual changes in the files.
Both is ok to me but I can't think of a hook version for now. The manual changes should be in BoardIndex.template.php where you made this changes:
Find:
/**
* Show information above the boardindex, like the newsfader
*/
function template_boardindex_outer_above()
{
global $context, $settings, $txt;
// Show some statistics if info centre stats is off.
if (!$settings['show_stats_index'])
echo '
<div id="index_common_stats">
', $txt['members'], ': ', $context['common_stats']['total_members'], ' • ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' • ', $txt['topics_made'], ': ', $context['common_stats']['total_topics'], '<br />
', $settings['show_latest_member'] ? ' ' . sprintf($txt['welcome_newest_member'], ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>') : '', '
</div>';
}
Add template_ic_recent_posts() before the function closing.
/**
* Show information above the boardindex, like the newsfader
*/
function template_boardindex_outer_above()
{
global $context, $settings, $txt;
// Show some statistics if info centre stats is off.
if (!$settings['show_stats_index'])
echo '
<div id="index_common_stats">
', $txt['members'], ': ', $context['common_stats']['total_members'], ' • ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' • ', $txt['topics_made'], ': ', $context['common_stats']['total_topics'], '<br />
', $settings['show_latest_member'] ? ' ' . sprintf($txt['welcome_newest_member'], ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>') : '', '
</div>';
template_ic_recent_posts();
}
The above manual changes is the basic. And since I have some extra time, I come with another suggestion.
1. Like the above, open your BoardIndex.template.php and find:
/**
* Show information above the boardindex, like the newsfader
*/
function template_boardindex_outer_above()
{
global $context, $settings, $txt;
// Show some statistics if info centre stats is off.
if (!$settings['show_stats_index'])
echo '
<div id="index_common_stats">
', $txt['members'], ': ', $context['common_stats']['total_members'], ' • ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' • ', $txt['topics_made'], ': ', $context['common_stats']['total_topics'], '<br />
', $settings['show_latest_member'] ? ' ' . sprintf($txt['welcome_newest_member'], ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>') : '', '
</div>';
}
Add something similar to the end of it just before closing:
/**
* Show information above the boardindex, like the newsfader
*/
function template_boardindex_outer_above()
{
global $context, $settings, $txt;
// Show some statistics if info centre stats is off.
if (!$settings['show_stats_index'])
echo '
<div id="index_common_stats">
', $txt['members'], ': ', $context['common_stats']['total_members'], ' • ', $txt['posts_made'], ': ', $context['common_stats']['total_posts'], ' • ', $txt['topics_made'], ': ', $context['common_stats']['total_topics'], '<br />
', $settings['show_latest_member'] ? ' ' . sprintf($txt['welcome_newest_member'], ' <strong>' . $context['common_stats']['latest_member']['link'] . '</strong>') : '', '
</div>';
template_recent_posts_2top();
}
2. We then rename function template_ic_recent_posts() to function template_ic_recent_posts2().
3. Lastly, add the following at the end:
/**
* The recent posts
*/
function template_recent_posts_2top()
{
global $context, $txt;
// Here's where the "Recent Posts" starts...
echo '
<div id="info_center" class="forum_category">
<h2 class="category_header">
<span id="category_toggle">
<span id="upshrink_ic2" class="', empty($context['minmax_preferences']['info']) ? 'collapse' : 'expand', '" style="display: none;" title="', $txt['hide'], '"></span>
</span>
<a href="#" id="upshrink_link2">', $txt['recent_posts'], '</a>
</h2>
<ul id="upshrinkHeaderIC2" class="category_boards"', empty($context['minmax_preferences']['info']) ? '' : ' style="display: none;"', '>';
template_ic_recent_posts2();
echo '
</ul>
</div>';
// Recent Posts collapse object.
echo '
<script><!-- // --><![CDATA[
var oInfoCenterToggle = new elk_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: ', empty($context['minmax_preferences']['info']) ? 'false' : 'true', ',
aSwappableContainers: [
\'upshrinkHeaderIC2\'
],
aSwapClasses: [
{
sId: \'upshrink_ic2\',
classExpanded: \'collapse\',
titleExpanded: ', JavaScriptEscape($txt['hide']), ',
classCollapsed: \'expand\',
titleCollapsed: ', JavaScriptEscape($txt['show']), '
}
],
aSwapLinks: [
{
sId: \'upshrink_link2\',
msgExpanded: ', JavaScriptEscape($txt['recent_posts']), ',
msgCollapsed: ', JavaScriptEscape($txt['recent_posts']), '
}
],
oThemeOptions: {
bUseThemeSettings: ', $context['user']['is_guest'] ? 'false' : 'true', ',
sOptionName: \'minmax_preferences\',
sSessionId: elk_session_id,
sSessionVar: elk_session_var,
sAdditionalVars: \';minmax_key=info\'
},
oCookieOptions: {
bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
sCookieName: \'upshrinkIC2\'
}
});
// ]]></script>';
}
This can also be added as a hook.
Great, thanks, but:
Fatal error: Call to undefined function template_ic_recent_posts2() in /www/htdocs/xyz/hp_elkarte/sources/Load.php(2612) : eval()'d code on line 377
Point 2 is already in your code, right? I don't have to do anything else then your code changes listed before?
Line 377 is an empty one. I attached my Load.php and my changed BoardIndex.template.php.
Nope. You have to manually do it and from what I can see from your BoardIndex.template.php, you missed it. That basically causes the error. So do change it (line 181) to function template_ic_recent_posts2().
You can view the running sample at
ElkArte Malaysia (http://elkarte.sch.my)
Fine, works now. Thanks a lot! :)
One small fix is really appreciated: The header line is missing the small arrow on the right whichs shows the expand status.
Sorry about that. I must have mistakeny deleted this &.nbsp;. Find:
// Here's where the "Recent Posts" starts...
echo '
<div id="info_center" class="forum_category">
<h2 class="category_header">
<span id="category_toggle">
Replace it with (adding back that ):
// Here's where the "Recent Posts" starts...
echo '
<div id="info_center" class="forum_category">
<h2 class="category_header">
<span id="category_toggle">
That should fix it.
Wait! That's not my fault. It is ElkArte bug. Please note this
@emanuele . This part is missing in the code when posted. I put a dot to make sure you get this: &.nbsp;
I attached a fixed file for you Jorin as the code cannot be properly posted.
Don't wanted to blame you! :-[ Thanks for your help! All good now! :)
Yep, there are some problematic combinations hanging around...
xref: http://www.elkarte.net/community/index.php?topic=2643.msg17918#msg17918 O:-)
Installed but not working. Recent posts still below. No errors. Any ideas?
As far as I can tell the one there should show the data of the last message, I'll try it out again later.
I can't get the addon to work until now but at least the edit to BoardIndex.template.php still works.
Hi,
BoardIndex.template.php What should be changed for 1.1B3 ?
Reply #4. Please note the missing &.nbsp; too.