News:

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

Main Menu

template_body_above() function

Started by The Wizard, November 19, 2015, 04:51:15 AM

Previous topic - Next topic

The Wizard

Hello:

I am customizing the index.template.php for a forum I am working on. To get the index page to look the way I want I commented out all the code. Being unfamiliar with some of the code in index.template.php I am hoping someone could take a look and make sure I have not created a unstable version. I am thinking I should keep the forum in maintenance mode code, but I am unsure whats the best way to achieve this.

Below is the code I have commented out.

Thanks

Wiz

function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

echo !empty($settings['forum_width']) ? '
<div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
<div id="header">

';

//<div id="top_section">
//<h1 class="forumtitle">
//<a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
//</h1>';

// the upshrink image, right-floated
//echo '
//<img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';
//echo '
//', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />' : '<div id="siteslogan" class="floatright">' . $settings['site_slogan'] . '</div>', '
//</div>

//echo '

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

// If the user is logged in, display stuff like their name, new messages, etc.
//if ($context['user']['is_logged'])
//{
//if (!empty($context['user']['avatar']))
//echo '
//<p class="avatar">', $context['user']['avatar']['image'], '</p>';
//echo '
//<ul class="reset">


//';
//<li class="greeting">', $txt['hello_member_ndt'], ' <span>', $context['user']['name'], '</span></li>
//<li><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a></li>
//<li><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></li>';



// Is the forum in maintenance mode?
//if ($context['in_maintenance'] && $context['user']['is_admin'])
//echo '
//<li class="notice">', $txt['maintain_mode_on'], '</li>';


// Are there any members waiting for approval?
//if (!empty($context['unapproved_members']))
//echo '
//<li>', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '</li>';

//if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
//echo '
//<li><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';

//echo '
//<li>', $context['current_time'], '</li>


//echo '
//</ul>';
//}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
//elseif (!empty($context['show_login_bar']))
//{
//echo '
//<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
//<form id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
//<div class="info">', $txt['login_or_register'], '</div>
//<input type="text" name="user" size="10" class="input_text" />
//<input type="password" name="passwrd" size="10" class="input_password" />
//<select name="cookielength">
//<option value="60">', $txt['one_hour'], '</option>
//<option value="1440">', $txt['one_day'], '</option>
//<option value="10080">', $txt['one_week'], '</option>
//<option value="43200">', $txt['one_month'], '</option>
//<option value="-1" selected="selected">', $txt['forever'], '</option>
//</select>
//<input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
//<div class="info">', $txt['quick_login_dec'], '</div>';

//if (!empty($modSettings['enableOpenID']))
//echo '
//<br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';

//echo '
//<input type="hidden" name="hash_passwrd" value="" />
//</form>';
//}

//echo '
//</div>


//';
//<div class="news normaltext">
//<form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
//<input type="text" name="search" value="" class="input_text" />&nbsp;
//<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
//<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
//if (!empty($context['current_topic']))
//echo '
//<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
//elseif (!empty($context['current_board']))
//echo '
//<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

//echo '</form>';

// Show a random news item? (or you could pick one from news_lines...)
//if (!empty($settings['enable_news']))
//echo '
//<h2>', $txt['news'], ': </h2>
//<p>', $context['random_news_line'], '</p>TEXT';

//echo '
//</div>



//echo '
//</div>
//';



//<br class="clear" />';

// Define the upper_section toggle in JavaScript.
echo '
<script type="text/javascript"><!-- // --><![CDATA[
var oMainHeaderToggle = new smc_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
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'] ? 'false' : 'true', ',
sOptionName: \'collapse_header\',
sSessionVar: ', JavaScriptEscape($context['session_var']), ',
sSessionId: ', JavaScriptEscape($context['session_id']), '
},
oCookieOptions: {
bUseCookie: ', $context['user']['is_guest'] ? 'true' : 'false', ',
sCookieName: \'upshrink\'
}
});
// ]]></script>';

//echo '
//<br class="clear" />


echo '
</div>';

// The main content should go here.
echo '
<div id="content_section">
<div id="main_content_section">';

// Custom banners and shoutboxes should be placed here, before the linktree.

// Monthly Banner code

global $sourcedir;

if (file_exists($sourcedir . '/banner/BannerRotation.php'))
{
require_once($sourcedir . '/banner/BannerRotation.php');
BannerRotation();
}

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


echo '<br/><br/>';

// Show the navigation tree.
theme_linktree();
}

C. Davis

What exactly are you trying to do? I would avoid commenting all that out as it is there for a reason. It is also posible you could achieve what you want by tweaking the CSS.

margarett

Quote from: C. Davis on November 19, 2015, 07:33:37 AM
It is also posible you could achieve what you want by tweaking the CSS.
This would be a better approach.

Anyway, have W3 validator to check your page. If it isn't broken, it's good :)
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

Kindred

well, I see a potential issue in that you have commented out the intecept which prevents users from entering the site in Maintenance mode
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

No, the intercept happens directly in index.php ;)

What he removes is the information to admins that the forum is in maintenance mode ;)
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

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Bigguy


Advertisement: