Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 39

Thread: includes:

  1. #11
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    try changing the code to <?php include('header.shtml'); ?>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  2. #12
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    yes, the long form always works better. You may also try an absolute path instead of a relative path:
    PHP Code:
    <?php
    include($_SERVER['DOCUMENT_ROOT'].'/absolute/path/to/header.shtml');
    // OR, depending on your PHP version / options:
    // include('http://www.yoursite.com/absolute/path/to/header.shtml');
    ?>

  3. #13
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Yes, but also there was a semicolon missing in his script.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  4. #14
    Join Date
    Oct 2009
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your help with all this,
    In my way of thinking the part where i am going wrong is where to upload the header.shtml to.

    If the header.php is in the includes folder where should i place the header.shtml file?

  5. #15
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by Master_script_maker View Post
    Yes, but also there was a semicolon missing in his script.
    whoops - didn't catch that.
    Quote Originally Posted by terriers33
    If the header.php is in the includes folder where should i place the header.shtml file?
    Practically speaking, you can put it wherever you like. What you have to double-check is that your include() function correctly points to it.

    If it's in the same folder as the include.php file, than just <?php include('header.shtml'); ?> is fine.

    If it's in a subfolder, then you need to write <?php include('subfolder/header.shtml'); ?>.

    In general, I prefer absolute or server-relative urls, like those I suggested above.

  6. #16
    Join Date
    Oct 2009
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    If it's in the same folder as the include.php file, than just <?php include('header.shtml'); ?> is fine.

    That is what i have done but no luck
    http://moe.enixns.com/~manchest/picKLE/index.php

    This will not be my real address when this problem is sorted out

  7. #17
    Join Date
    Oct 2009
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    After many hours, and all your help i have found the answer to my issue.

    The index.php code shows
    include("./picKLE-includes/header.php");

    I replaced it with
    include("picKLE-includes/header.shtml");

    But still one problem.... the header is there showing up but without the style sheet???
    Sorry!

  8. #18
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Understand that PHP includes ONLY get the exact code inside the second page and place it into the first page. Any problems with stylesheets, layout, etc., are a problem with the html, not with the include. You must figure out what is wrong with the html, then how to fix it on the two pages.

    The stylesheet probably isn't included in the main page's head section, since that's where it needs to be added as a tag.

    Thus you have found one of the main problems using includes: placing one part in two places in the code.

    The solution is to include two parts, or just hard-code the stylesheet into the top. Alternatively you could set up a complex system where you have an include with two parts as variables, then output one in the head section and one in the body; but that is complex and more work than just doing it separately. Basically, that's moving on toward a template setup, which would be useful if you were doing more than just a simple include.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. The Following User Says Thank You to djr33 For This Useful Post:

    terriers33 (10-08-2009)

  10. #19
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by djr33 View Post
    ...Alternatively you could set up a complex system where you have an include with two parts as variables, then output one in the head section and one in the body; but that is complex and more work than just doing it separately. Basically, that's moving on toward a template setup, which would be useful if you were doing more than just a simple include.
    That's what I'm doing now... like you said, it's complicated, but very rewarding when it finally works like it should. (SO cool to get html that validates...!) And, fortunately, I only ever have to do it once.

  11. #20
    Join Date
    Oct 2009
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I am not quite sure its a stylsheet issue...thats what i did think.
    Could it be the header images???

    If you could check these two images
    One is my header that works fine on the other shtml pages, abut us etc.

    The other is how the header shows up on the picKLE index.php page.

    Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •