News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Collapsible Info Area?

Started by bustedupcowgirl, August 05, 2009, 08:43:58 AM

Previous topic - Next topic

bustedupcowgirl

I've dug through the MODs and haven't been able to find what I'm needing...

Right now I use the Ad Mod to post pictures on my home page that I change every month. Most of the members love this but some would like to have a box where they can collapse them to make the forum a little more "work friendly" for them.

Is there a mod out there already? If not I would love to see one. For 1.1.10 of course  :)

Antechinus

You could post them in the news fader and make that collapsible. Just a thought. I've already done a collapsible news fader for 1.1.x by nicking the code from 2.0.

bustedupcowgirl

I tried that but the persons "profile" or whatever it's called is also in the same area as the news, as is the search box....so they have to view their avatar to have the news open too. Is this correct? Or is there a way of separation the two?

I am a little SMF/technically challenged so I appreciate your help.

Antechinus

Hmm. Ok so you're using the default theme but I'm not quite clear on what you do want to see and what you don't want to see. Are you trying to hide avatars or other pictures?

bustedupcowgirl

I want them to have a choice if they want the box up top with their avatar and states visible or not. Then I want them to have a choice if they want to see the monthly pictures or not.

If I use the news section to put the pictures in, with everything having to be open, it takes up quite a bit of room, it also throws off the format of the pictures. Plus I know most of my members do not want to see their stats but would like to see the pictures.

Antechinus

Ok, so as well as the news lines there is the news fader, which is that box that sits below the linktree and above the first category. You can make that collapsible, and you can dissociate the content from the news section in admin. I've done a shoutbox in the news fader box for a guy one time. You can put anything you like in it.

Do you want to have the newslines available as well? If you do that's fine, but it would mean you'd have to change pictures in the fader box by manually editing the image url in the template.

bustedupcowgirl

I'll give that a try, thanks. No, I don't need the news visible...aside from playing with it for the pictures I don't use it. Thank you for your help and hopefully I can get that working (or figured out for us challenged ones, lol). I didn't realize the fader was a separate area from the news section.

Antechinus

The fader is controlled in BoardIndex.template.php. If you're happy to ditch the newslines up the top you can use the News section in admin to change the fader's content. You can even set up umpteen pages of images in it and set the change interval to whatever you like, just like you would make news items anyway. Put the images in BBC img tags and they're good to go.

To make it collapsible there is a bit of messing with javascript involved, but I have the edits somewhere and can dig them out tomorrow if you like. 

bustedupcowgirl

I would appreciate that. The pictures posted perfect in the fader so collapsing it would make it exactly what I need. I am a bit apprehensive in playing with the javascript (I know I need to get my feet wet sometime) but I may end up looking for a hired hand to do it. I just wanted to let you know that if it might change your decision to share the info with me.

Antechinus

Don't worry about it. I know nothing about javascript. I just hit one of the other teamsters up for the code when I wanted it ages ago. :D
It's pretty late where I am but I'll find the bits tomorrow and post them, or someone can edit your files for you. Whatever works. You will need ftp access to download and edit default theme files but as long as you have that there's no drama. You just can't get at the default theme via the SMF admin centre.

bustedupcowgirl

Ok, yes, I do have all of that....I just don't know how to use it  :-[


Antechinus

Ok so I found where I did this before. I've attached a file called newscollapse.js and no prizes for guessing what it does. :D
This file just goes into your default theme folder (or any other theme if you want to use it on another).
You also have to make some minor edits to index.template.php and BoardIndex.template.php. Edits are:

Index.template.php:

Find:

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';


Replace with:

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<script language="JavaScript" type="text/javascript" src="', $settings['theme_url'], '/newscollapse.js"></script>
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';



BoardIndex.template.php:

Find:

// Show the news fader?  (assuming there are things to show...)
if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
{
echo '
<table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 2ex;">
<tr>
<td class="catbg"> &nbsp;', $txt[102], '</td>
</tr>
<tr>
<td valign="middle" align="center" height="60">';


Replace with:

// Show the news fader?  (assuming there are things to show...)
if ($settings['show_newsfader'] && !empty($context['fader_news_lines']))
{
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
// Create the main header object.
var smfNewsFadeToggle = new smfToggle("smfNewsFadeScroller", ', empty($options['collapse_news_fader']) ? 'false' : 'true', ');
smfNewsFadeToggle.useCookie(', $context['user']['is_guest'] ? 1 : 0, ');
smfNewsFadeToggle.setOptions("collapse_news_fader", "', $context['session_id'], '");
smfNewsFadeToggle.addToggleImage("newsupshrink", "/collapse.gif", "/expand.gif");
smfNewsFadeToggle.addTogglePanel("smfNewsFader");
// ]]></script>
<table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="4" style="margin-bottom: 1ex;">
<tr>
<td class="catbg" align="center"><a href="#" onclick="smfNewsFadeToggle.toggle(); return false;"><img id="newsupshrink" src="', $settings['images_url']. '/', empty($options['collapse_news_fader']) ? 'collapse.gif' : 'expand.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="padding: 3px 2px 3px 0px;" align="right" /></a>', $txt[102], '</td>
</tr>
<tr>
<td valign="middle" align="center" height="60" id="smfNewsFader"', empty($options['collapse_news_fader']) ? '' : ' style="display: none;"', '>';


Voila! You now have a nifty collapsible news fader box thingy. Impress your friends.

nay27uk

The wecome are of the forum alredy is colapsable in default template right beside the clock

Antechinus

We know that. It's a different issue.

nay27uk


bustedupcowgirl

Thanks for the code, you explained it well enough that I'm not as apprehensive about doing it myself. Ok, tomorrow I'm going to take a deep breath and go for it. Wish me luck.

Antechinus

Keep a backup copy of the file. You may need it. ;)

Advertisement: