Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Collapse/Expand Headers

Aloittaja OneLung, elokuu 04, 2006, 04:07:17 IP

« edellinen - seuraava »

OneLung

I have searched and searched this site and I am still blonde.

Can someone tell me how to disable the users ability to expand/collapse the category headers by clicking the '-' or '+' signs in the right corner.

I would like to disable the users ability to collapse the main header on the top that shows users information.  The other category headers I would like to leave alone and expandable/collapsable.

Thanks in advance.

Daniel.

sawz

you have control over that when you create the board.
go into admin...boards..and modify a board, you'll see the check box
allowing collapse.

what version do you have?
keep smiling, they'll always wonder what your up too.....

OneLung

Hi,

I have version 1.1RC2

The only expand/collapse button I need to disable is the one at the top of the page (default theme) next to where it displays the date and time.

Thanks,

Daniel.

sawz

Lainaus käyttäjältä: OneLung - elokuu 04, 2006, 04:07:17 IP
Can someone tell me how to disable the users ability to expand/collapse the category headers by clicking the '-' or '+' signs in the right corner.

thats not a category and i'm not sure if you can do that.
keep smiling, they'll always wonder what your up too.....

codenaught

#4
Open and edit: Themes/theme_name/index.template.php
Backup first!

Find:

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '

<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = ', empty($options['collapse_header']) ? 'false' : 'true', ';

function shrinkHeader(mode)
{';

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";

current_header = mode;
}
// ]]></script>';

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = ', empty($options['collapse_header_ic']) ? 'false' : 'true', ';

function shrinkHeaderIC(mode)
{';

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);';
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "', $context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>


and replace it with
echo '

Find:


<table id="upshrinkHeader2"', empty($options['collapse_header']) ? '' : ' style="display: none;"', ' width="100%" cellpadding="4" cellspacing="0" border="0">


Change to:

<table id="upshrinkHeader2" width="100%" cellpadding="4" cellspacing="0" border="0">

Find:

<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="', $settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' : 'upshrink2.gif', '" alt="*" title="', $txt['upshrink_description'], '" align="bottom" style="margin: 0 1ex;" /></a>

and remove.

Find:

<tr id="upshrinkHeader"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
and change it to:

<tr id="upshrinkHeader">
Dev Consultant
Former SMF Doc Coordinator

OneLung

Thank you for the help.  Your mod worked great.  The only problem I encountered was that the expand/collapse button still existed on the Forum Stats box at the bottom of my index page.  If you click on the button, you get a JavaScript error because the code it refers too no longer exists.

I opened up Boardindex.template.php, found and removed the following code and all is working good now.

<div class="catbg" style="padding: 6px; vertical-align: middle; text-align: center; ">
<a href="#" onclick="shrinkHeaderIC(!current_header_ic); return false;"><img id="upshrink_ic" src="', $settings['images_url'], '/', empty($options['collapse_header_ic']) ? 'collapse.gif' : 'expand.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin-right: 2ex;" align="right" /></a>
', $txt[685], '
</div>
<div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>


Thanks again... I LOVE this message board software!

Daniel.

Advertisement: