#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    26
    Rep Power
    0

    Question include() pages not taking CSS style?


    Excuse my noobness, as I just started getting into PHP. Quite an exciting language it is!

    Anyways, my site (splix.net) is basically set up using query strings, which took me FOREVER to figure out, but I think I got it down pretty well.

    I'm just going to describe my site setup because some people weren't sure of what was going on...

    index.php (front page) is the banner and the menu and the copyright footer. The default redirect inside of index.php goes to main.php which has the little Navigation image that you see when you first go to my site. All my pages are basically set up in the same way, just with different data. They are all being included with this script...don't know if this is the most efficient way to do it but it seems to work.

    PHP Code:
    <?php

    if ($_GET[page] !=""){
    $file "" $_GET[page] . ".php";
    } else {
    $file "main.php";
    }
    include(
    "$file");

    ?>
    Now, I have CSS styles on ALL of my pages. For example if you go to about.php on my server you will see the style sheet in action. But when you go to a page such as http://www.splix.net/?page=contact, it doesn't take the style correctly for some reason. Why I have no idea...

    Another question I have is why the TITLES of the pages do not work either. For example the main.php title is splix.net :: v1. The about page title is splix.net :: v1 :: about. But when I include the pages the titles don't seem to go through...so I came up with this idea...

    I would put the <head></head> tags UNDER the script above, using something like this:

    PHP Code:
    <title>splix.net :: v1 :: <?php print $file?></title>
    Don't know if that's allowed or not...seems to be working correctly though.

    Sorry for all the questions...I'm just a very confused person right now.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Melbourne, Australia
    Posts
    8
    Rep Power
    0
    Hi, I had a look at that page and there seams to be a problem with the HTML code you are rendering. The <HEAD> section should preceed the <BODY> section but on your contacts page they are reversed.

    Cheers

    Dave
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Land o' da d00med
    Posts
    126
    Rep Power
    0
    well if it's any compensation to you your site works great for me, I'm on the http://www.splix.net/?page=contact page and the title has "contect me" in the end of it, the css is working good (hover works) so I don't get the problem - code also seems okie.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    26
    Rep Power
    0
    The links (and visited links) are supposed to be a light blue color...#7A9DBD in particular.

    Are they like the default internet explorer blue (not #7A9DBD) for you?
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Melbourne, Australia
    Posts
    8
    Rep Power
    0
    You need to look at where you are include()ing your content in relation to the rest of the file.

    You have 2 <HEAD> and <BODY> sections, its only really by the good grace (and poor parsing of browsers) that you get what you want sometimes.

    <TITLE>, <STYLE>, <SCRIPT> should all be included in <HEAD></HEAD> and this should come before the <BODY> section of your HTML.

    Currently your <STYLE> section is within the 2nd <HEAD> block which is not valid HTML.

    Cheers

    Dave
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Land o' da d00med
    Posts
    126
    Rep Power
    0
    ohhh man just took a look at the code..
    listen you made a.... well I wouldn't say common... but you made a small mistake here, you can't have 2 <html>,<head>,<body> tags - the problem is that you're having the css styling on your standalone .php files too - wut I suggest you to do is to go through all your php files except for index.php and delete everything from <HTML> to <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD="preloadImages();"> - after that stuff should work - but back up yer stuff anyways.
    ohh yeah and replace
    <title>splix.net :: v1</title>
    with
    <title>splix.net :: v1 :: <?php echo $file; ?></title>

    and everything should work.. keep us updated man..
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Melbourne, Australia
    Posts
    8
    Rep Power
    0
    Just a tip, if you are moving to a CSS based website then you can move you <BODY> tag into css

    ie

    <BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD="preloadImages();">

    becomes something like

    body {
    background-color: #FFFFFF;
    margin: 0;
    padding: 0;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    }

    leaving you with

    <BODY ONLOAD="something">
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    26
    Rep Power
    0
    This makes me extremely mad...

    In my links section I did not have a # infront of the color codes...therefore they were not working.

    Stuff like that just pisses me off...

    Thanks guys everything is working correctly now.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    377
    Rep Power
    11
    PHP Code:
    <?php

    if ($_GET[page]){
    $page =  $_GET[page];
    $file "$page.php";
    } else {
    $file "main.php";
    }
    require(
    "$file");

    ?>
  18. #10
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Melbourne, Australia
    Posts
    8
    Rep Power
    0
    yeah - css is a bitch like that, i always pass my ccs though a validator if its not working properly. That gets the errors, some of the time,

    Cheers

    Dave

IMN logo majestic logo threadwatch logo seochat tools logo