News:

Wondering if this will always be free?  See why free is better.

Main Menu

How to disable forum header collapsible function

Started by minico, November 11, 2013, 06:14:59 PM

Previous topic - Next topic

minico

Hey guys hope everyone is doing stellar today!

Just a quick question.  I tried searching and couldn't find anything on the SMF site about this.  Maybe I was using the wrong terminology...  Anyways, if you look at the theme that we are currently using on this forum, at the top right of your screen you will see an arrow that you can click on to collapse the header to where you can hide your avatar and screen name etc.  The theme that I am currently using also utilizes the feature and I would like to do away with it.  I would just like my members to see their avatar and screen name.  This also keep a login area open as well.  I have my option in my admin area to show a quick login on every page selected, but it is not showing up.   I am figuring that I will need to go into my themes index.template.php to make this change.  Am I correct? Also, what string of code would I need to modify to make this happen.  Thanks

Arantor

The string of code is different in each theme that supports it >_<

Also, the new default theme in 2.1 removes this option, it's just 'expanded' all the time.

margarett

As usual, you should address theme related issues to the author (theme support topic) as they, much better than we, know how they theme works ;)

Anyway, since we're here already :P the first bit should be easy.
In the default theme, index.template.php you have something like this: (please note that it can be different in your theme)

echo '
<img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';

Just comment it out and it goes away.

As for the second bit, it's probably not that simple...

edit: sorry Arantor, too much typing to throw away :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

minico

Thanks guys, and sorry, I didn't even think of contacting the themes designer to ask the question.  The theme I am using is almost the same as the one we are using here.  Basically just the color scheme looks a little different. 

Margaret, when you say comment it out, do you mean delete the string of code?  I found the string of code in my index.template.php files and it is exactly the same as the one you posted.

margarett

No need to delete (but you can, if you want). Just add two slashes before each of those lines (PHP comment, C-style) --> http://php.net/manual/en/language.basic-syntax.comments.php)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

minico

Hi Margaret,  I tried to delete the line of code and got a parse error..  I put the hashes infront of the code and nothing happened.

I looked a little further down from that one line of code and saw this

Quote// the upshrink image, right-floated
   echo '
      <img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';    

   // Show the menu here, according to the menu sub template.
   template_menu();

   echo '
      </div>
   </div></div>
   <div id="header1"><div class="frame">
      <div id="upper_section" class="middletext"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
         <div class="user">';

You see where it says collapse header?  Could I change something there to make it non collapsible?  Sorry about my ignorance, but I know just enough to be dangerous...


margarett

Just this:

   // the upshrink image, right-floated
//   echo '
//      <img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';   

Should work.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

minico

Okay Margarett, that did the trick, that took the .pmg image away that allows the user to choose to expand or collapse the header.  The problem is, is that it defaults to the header being collapsed.  How would I force it open now and to remain open?

margarett

Actually it shouldn't default to that... It's probably a setting from your user (that is memorized somewhere -- cookie, I think).

Just add this:

$options['collapse_header'] = 0;

After

function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

minico

Well Bruno, I did like you said, added that code under neath the other.  closed out of everything and ran CCleaner to clear my browser and cookies, went back to the website and it is still defaulting to the header being collapsed...  Any other ideas?

minico

Okay guys, none of that worked...  I removed the hashes and the additional code that you gave me and basically went back to the default code. 

I scrolled down the page and found the following code.

// Define the upper_section toggle in JavaScript.
echo '
<script type="text/javascript"><!-- // --><![CDATA[
var oMainHeaderToggle = new smc_Toggle({
bToggleEnabled: false,
bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'true' : 'false', ',
aSwappableContainers: [
\'upper_section\'
],
aSwapImages: [
{
sId: \'upshrink\',
srcExpanded: smf_images_url + \'/upshrink.png\',
altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
srcCollapsed: smf_images_url + \'/upshrink2.png\',
altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
}
],
oThemeOptions: {
bUseThemeSettings: ', $context['user']['is_guest'] ? 'true' : 'false', ',
sOptionName: \'collapse_header\',
sSessionVar: ', JavaScriptEscape($context['session_var']), ',
sSessionId: ', JavaScriptEscape($context['session_id']), '
},
oCookieOptions: {
bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
sCookieName: \'upshrink\'
}
});
// ]]></script>';

minico

if you look at the 4th line of code down, it says

btoggle enabled: false,


Originally it said:

btoggleEnabled: true:

I changed it to false and then refreshed my browser and the upshrink.png image disappeared from the header and the header opened up and remained static like I wanted.  Hope this helps anyone else that would like to accomplish this.

hitsme

Quote from: minico on November 11, 2013, 10:10:57 PM
if you look at the 4th line of code down, it says

btoggle enabled: false,


Originally it said:

btoggleEnabled: true:

I changed it to false and then refreshed my browser and the upshrink.png image disappeared from the header and the header opened up and remained static like I wanted.  Hope this helps anyone else that would like to accomplish this.

Thanks was very helpful still works

Advertisement: