Uutiset:

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

Main Menu
Advertisement:

Custom header almost there!

Aloittaja bobdole2281, elokuu 15, 2013, 02:36:00 IP

« edellinen - seuraava »

bobdole2281

I am trying to include a custom header at the top of my forum. I got the index.php file and edited it slightly.

Here is the code I used:

$forum_version = 'SMF 2.0.4';

// Get everything started up...
define('SMF', 1);
if (function_exists('set_magic_quotes_runtime'))
@set_magic_quotes_runtime(0);
error_reporting(defined('E_STRICT') ? E_ALL | E_STRICT : E_ALL);
$time_start = microtime();

/********************************************************************
                                               Right Here
********************************************************************/
// Add in the header
include('header2.php');
echo "<div id='middle'>";
                       /********************************************************************
                                               Right Here
********************************************************************/

// This makes it so headers can be sent!
ob_start();

// Do some cleaning, just in case.
foreach (array('db_character_set', 'cachedir') as $variable)
if (isset($GLOBALS[$variable]))
unset($GLOBALS[$variable], $GLOBALS[$variable]);


It is working without errors finally, but it doesn't quite look right. I am thinking I either have to change the CSS somehow or add the include header under a different line. Any ideas? Any help would be greatly appreciated. Below is an attachment of how it looks after I run that code. I want no odd spacing from the top and no repeat backgrounds. I also end  the div "middle" at the end of it the code.

Please help me out. This site has always been the best! :)

bobdole2281



Mick.

I would think by adding a CSS link to the header2.php should do it?


<link rel="stylesheet" type="text/css" href="complete url to css file goes here/css/whaterever.css" />

bobdole2281

Thanks, that link is helpful so far. I've been editing "index.css"

I changed the margin and the padding to 0, but there is still a huge drop off at the top. Any idea which of the files I should edit?

bobdole2281

Lainaus käyttäjältä: Mick. - elokuu 15, 2013, 02:52:42 IP
I would think by adding a CSS link to the header2.php should do it?


<link rel="stylesheet" type="text/css" href="complete url to css file goes here/css/whaterever.css" />

I do have a style link in header2.php, here it is:

<link href="css/newstyles.css" rel="stylesheet" type="text/css" media="screen">

It seems to be being overwritten

Mick.

Rename the classes so they don't get overwritten.

Post your CSS code so we can take a look.

bobdole2281

Will do. Right now I just want to get the body background to work. I can't rename body, so I'm not sure what to do:

My css I am linking to says this:
body { background-image:url(../images/bg.jpg); background-attachment:fixed;
            background-repeat:repeat; font-family: Arial, Helvetica, sans-serif; margin:0px; }


I also changed the body tag in ".../Themes/default/css/index.css" to:
body
{
background: url(../images/bg.jpg) no-repeat fixed;
font: 78%/130% "Verdana", "Arial", "Helvetica", sans-serif;
margin: 0 auto;
padding-top:0px;
}


my image bg.jpg is just a gray background. It is still showing that deadpool background for somereason. Let's just take it 1 step at a time and see if I can get my background to quit being overridden. Thanks for all the help guys! :)

bobdole2281

Finished! I was altering the wrong css. If you do this be careful! You might have to rename some of your divs. I had to rename "wrapper" because smf used wrapper as well.
The correct css was in ../Themes/yourtheme/css/index.css

In my exploits trying to learn everything I did break a few things though. I put them in my other thread asking for help. I seemed to have messed up the link to my avatars. Messed up the background while replying and messed up the screen that appears after I log out or make a post. I think I overwrote an index.php somewhere. If you know anything about those problems please try and help.  http://www.simplemachines.org/community/index.php?topic=509628.0

Otherwise, good luck to everyone trying to edit your styles!

Advertisement: