MyBB Community Forums

Full Version: VSNM: Very Simple News Mod
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
And when I say simple, I mean simple.

This mod will allow you to toggle a small "headline" or "news" bar across the top of your forums through your Board Options.

Setting up the settings:

Go into your ACP and under the "Board Settings" category, add a new setting. We're going to first create a new group (title it whatever you want, something like "News Settings", name is the ID (doesn't matter either)). After that, add two new settings.

Title: Whatever you want.
Description: Whatever you want.
Setting Name: For your first setting, newstoggle, and your second, newstext.
Setting Type: First Setting: text Second setting: textarea
Value: Will be the default value the first time you use it. Can leave blank, doesn't matter.
Display Order: 1 and 2 respectively.
Group: Whatever you named your new group to be (like "News Settings")

Configuring It:

Go into your board configuration, find your new setting group you just added (something like "News Settings"), and go into it. For the first setting, you have to type either "inline" (on) or "none" (off), no quotes. If you don't, it might not work. The second option (the big text box) is what the headline or news is, so whatever you like.

Modifying the template:

Modify your Index Page Templates / index template.

Find:

{$header}

Add after:

<div style="display:{$mybb->settings['newstoggle']}"><table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr><td class="trow1">
<center><b>Latest News:</b> {$mybb->settings['newstext']}</center>
</td></tr>
</table><br /></div>

Save, and visit your homepage to test if your news module works.

Working demo should be available at:
http://forums.wow-stormriders.net/index.php

Disclaimer:

I did this mod at midnight or so, so if it's hard to follow, I apologize. When I'm more coherent, I may possibly rewrite it to be more understandable.

I do not guarantee this mod on all forums (it might not work if you have a heavily themed board), and I will only provide limited support in this thread only. It's really pretty simple, you should be able to figure most of it out on your own, anyway.

There was probably a better way to do the toggle part of it rather than using a div with CSS, but I haven't explored MyBB extensively enough to know how to do that.

Let me know if you liked this mod! Smile
I would have used the CSS "display" attribute instead of "visibility" since with display:none in CSS, the "thing" being hidden doesn't take up page space.
Yeah... I thought about that, but it was really late. Changed, thanks for the suggestion.