Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Topic started by: dash8 on September 14, 2010, 07:28:24 PM

Title: I want to change my header for rc3
Post by: dash8 on September 14, 2010, 07:28:24 PM
I am not a coder just your every day noob who has no idea, but can follow instructions.
I am wanting to mod my header in the   SMF Default Theme - Curve  i want to remove

Hello admin
Show unread posts since last visit.
Show new replies to your posts.
September 14, 2010, 10:55:18 pm

search box   
News:
SMF - Just Installed

i presume it is ssi coding and would like to replace that area with a custom  image. i was using HeaderRotator.v.2.1 which was good but it is not compatable with rc3. 
Title: Re: I want to change my header for rc3
Post by: xenovanis on September 15, 2010, 07:09:26 AM
Before you do this, I suggest making a copy of the default theme in Admin -> Themes and Layout -> Manage and Install. If you don't want to create a new theme, please make a backup of the file you intend to modify.

/Themes/theme1/index.template.php, find en remove:

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


Next, find

<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>
</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" style="margin: 0;" 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>';

echo '
</div>
</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>';


replace with

<div align="center">
<img src="http://www.yoursite.com/images/banner.png" alt="Banner" />
</div>


How do I modify files? (http://www.simplemachines.org/community/index.php?topic=24110.0)
Title: Re: I want to change my header for rc3
Post by: Hj Ahmad Rasyid Hj Ismail on September 15, 2010, 07:49:03 AM
Normally, I just comment it out especially when I used the default theme. I would avoid removing line of codes because it will be easy for me when I installed any other mods that going to change that line later on. (I don't like error during installation. It always make me panic.  :D)
Title: Re: I want to change my header for rc3
Post by: xenovanis on September 15, 2010, 07:51:13 AM
You're absolutely right. In fact, it would be even better to make a copy of the default theme. I forgot about that. Thanks ahrasis :)
Title: Re: I want to change my header for rc3
Post by: dash8 on September 19, 2010, 05:29:05 AM
i get this error it highlighted line 177 :o

Parse error: parse error, expecting `','' or `';'' in .../Themes/default/index.template.php on line 177

168:          </h1>';
169:    echo '
170:          ', 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="align_right">' . $settings['site_slogan'] . '</div>', '
171:       </div>      <div align="center">         <img src="http://localhost/site/MGalleryItem.php?id=2" alt="Banner" />      </div>
172:
173:       // Show the menu here, according to the menu sub template.
174:       template_menu();
175:
176:    echo '
177:          <br class="clear" />';178:
179:       // Show the navigation tree.
180:       theme_linktree();
181:                             

were do go from here?

could i approach header rotator to upgrade?
Title: Re: I want to change my header for rc3
Post by: Deaks on September 19, 2010, 10:20:05 AM
remove the echo' on 176
Title: Re: I want to change my header for rc3
Post by: xenovanis on September 20, 2010, 07:35:29 AM
No idea how where the 178 comes from.  :P


176:    echo '
177:          <br class="clear" />';178:
179:       // Show the navigation tree.
180:       theme_linktree();


should be

176:    echo '
177:          <br class="clear" />';
179:       // Show the navigation tree.
180:       theme_linktree();
Title: Re: I want to change my header for rc3
Post by: Deaks on September 20, 2010, 07:37:09 AM
xenovanis

Thats a copying over error from the message that would have been seen as admin.
Title: Re: I want to change my header for rc3
Post by: xenovanis on September 20, 2010, 07:43:47 AM
Quote from: Runic on September 20, 2010, 07:37:09 AM
xenovanis

Thats a copying over error from the message that would have been seen as admin.

Huh? Oh, I see now  :) Sorry, lack of sleep.

However, I doubt removing the echo' would work. Instead, I'd try this:

</div>      <div align="center">         <img src="hxxp:localhost/site/MGalleryItem.php?id=2 [nonactive]" alt="Banner" />      </div>


to this

</div>      <div align="center">         <img src="hxxp:localhost/site/MGalleryItem.php?id=2 [nonactive]" alt="Banner" />      </div>';


What I posted earlier was tested. I have this working, however for now I am unable to access the file. I'll check later if this isn't fixed.