Simple Machines Community Forum

Customizing SMF => Graphics and Templates => Aiheen aloitti: Surf3rDud3 - marraskuu 14, 2011, 06:23:49 AP

Otsikko: Adding something to a Header
Kirjoitti: Surf3rDud3 - marraskuu 14, 2011, 06:23:49 AP
Hello... I was wondering if anyone can help me out with something small?

Id like to have a button in the header... Of course id make the button and stuff but i need some help on where to edit this and how difficult it would be to do so.

What I am wanting to create is a Join Server Button for my bf3 server and id like it up there so when other join they can click it and it sends them to the battlelog page...

Version: 2.0.1
Theme: Modified DarkBreak 2.0



I thought maybe had something to do with this in the index.css
#logo {
position: absolute;
top: 0;
left: 0;
display: block;
width: 320px;
height: 85px;
background: url(../images/custom/logo.gif) no-repeat;
cursor: pointer;
}


I thought maybe to add under it to recreate one by it but it didn't work... :p
#logo2 {
position: absolute;
top: 0;
center: 0;
display: block;
width: 320px;
height: 85px;
background: url(../images/custom/logo.gif) no-repeat;
cursor: pointer;
}

Otsikko: Re: Adding something to a Header
Kirjoitti: Surf3rDud3 - marraskuu 14, 2011, 06:37:09 AP
Can you please move this to Graphics And Templates? Just realized that was there. Thx :)
Otsikko: Re: Adding something to a Header
Kirjoitti: Sir Osis of Liver - marraskuu 14, 2011, 12:28:09 IP

You can do that in index.template.php in the header template.

Otsikko: Re: Adding something to a Header
Kirjoitti: Surf3rDud3 - marraskuu 15, 2011, 06:03:32 AP
How so? Can you show me the piece of code so i know where to look?
Otsikko: Re: Adding something to a Header
Kirjoitti: Sir Osis of Liver - marraskuu 15, 2011, 02:51:35 IP
Don't have this theme, but just roughly, you have to add the button next to this div -



<div id="top_section">
', empty($context['header_logo_url_html_safe']) ? '
<h1 class="forumtitle2">' . $context['forum_name'] . '</h1>' : '', '
<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>';

template_user_menu();

echo '
</div>


Otsikko: Re: Adding something to a Header
Kirjoitti: Surf3rDud3 - marraskuu 17, 2011, 04:02:04 AP
The above code isn't in there...

Can you make a example code for me... I know some but i havent done anything like this.
Otsikko: Re: Adding something to a Header
Kirjoitti: Sir Osis of Liver - marraskuu 17, 2011, 10:59:22 IP
Ok, in index.template.php, find this -



<div class="wrapper">
<div id="hdr-l">
<div id="hdr-r">
<div id="header">
<div id="time">
', $context['current_time'],'
</div>



and change it to this -



<div class="wrapper">
<div id="hdr-l">
<div id="hdr-r">
<div id="header">

<div>
<a href="http://www.google.com" title=""><span id="new_button"> </span></a>
</div>

<div id="time">
', $context['current_time'],'
</div>




In /css/index.css find this -



#logo {
position: absolute;
top: 0;
left: 0;
display: block;
width: 320px;
height: 85px;
background: url(../images/custom/logo.gif) no-repeat;
cursor: pointer;
}



and change it to this -



#logo {
position: absolute;
top: 0;
left: 0;
display: block;
width: 320px;
height: 85px;
background: url(../images/custom/logo.gif) no-repeat;
cursor: pointer;
}

#new_button {
position: absolute;
top: 25px;
left: 450px;
background: url(../images/on.png) no-repeat;
width: 43px;
height: 43px;
border: 2px white groove;
cursor: pointer;
}




Add your own url and image, tinker with the formatting, and you should be all set.

Otsikko: Re: Adding something to a Header
Kirjoitti: Surf3rDud3 - marraskuu 19, 2011, 10:11:22 IP
I love you...