MyBB Community Forums

Full Version: Question about index- and header template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, i tried to show the latest threads on a sidebar. I tried this :
http://community.mybb.com/thread-110658-...#pid805233

But if i use this code, the recent threads will be only shown in the index page. I want that the recent threads are displayed in every page, even when you are reading a thread. So i need to edit the header template instead of the index template. Where should i insert the code now? there is no header.php or something like that ..

Thanks
Simply edit header template. At the end add:

<div class="sidebar" style="float: right;width: 24.5%;">
<!-- sidebar code goes here -->
</div>
<div class="forums" style="float: left;width: 75%;">

Also, add one </div> at the very beginning of your footer template.
I tried to use {$latestthreads} in the header template,but it doesn't work ..
And i can't insert a php code in the template file, first i must insert the php code in a php-file.
Change the hook.
To what should i change it? to $plugins->run_hooks("header_start"); ?
Set 'global_start'.
Okay, so in the index.php i changed
$plugins->run_hooks("index_start");
to:
$plugins->run_hooks("global_start");
and after this, i inserted the code which was posted here :
http://community.mybb.com/thread-110658-...#pid805233

But it still doesn't work. There is no error or something like that, there is just nothing. I can't see a change.
My GOD!!! I thought you are using a plugin. I skipped the part that you are editing index.php.
Don't change that anchor of index.php.

Why don't you use a plugin like one borbole made and change its hook to work in header?
http://demonate.com/thread-619.html
http://mods.mybb.com/view/recent-threads-forum-sidebar
because in my theme, there is already a sidebar. i'm using this theme :
http://mods.mybb.com/view/cms-bb
i tried to install a sidebar plugin, but the layout crashed then because there were actually 2 sidebars. so i just need the code for recent topics so i can insert that manually into the sidebar Smile
But the fact is you have to edit the plugin to generate the value of the variable as only sidebox blocks, not along with the sidebar codes.

Or you can do one thing, use the recent topic index plugin by vbgamer45 and change the hook, then after activating the plugin move the variable {$recenttopics} from index template to header template (not modifying activation changes, as it is that theme specific).

http://mods.mybb.com/view/recent-topics-on-index-page

Change this hook:
$plugins->add_hook("index_end", "recenttopicsindex_show");

I believe it will work.