www.webdeveloper.com
Results 1 to 4 of 4

Thread: file structure and php include statement

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    43

    file structure and php include statement

    Hello everyone:

    I created photo gallery page with php extension - yntour.php. I want to access the header.php file located in the includes folder by using php include satement. Header file has access to css files.

    php include statement in yntour.php file

    PHP Code:
    $page_title "Yun Nan Tour Gallery";
       include(
    '../includes/header.php'); 
    access css file within header.php
    Code:
    <style type="text/css">
       @import url(css/global.css);
       @import url(css/navbar.css);
     </style>
    when user browsed yntour.php page the navigation bar fomat is not correct.
    the browser complained that global.css and navbar.css can't be found.

    the file navbar.css controls navigation bar format is in css folder.
    photo-gallery.css (is in css folder) controls the format for yntour.php page

    I think I am confused with the file structure and don't know how to access specific file by using php include statement. Please take look at my code and file structure image to help me troubleshoot the problem. Thanks!


    link to yntour.php page

    link to corret navbar fomat

    Link to file structure

    webdev077

    1-5-08
    Last edited by webdev077; 01-05-2008 at 07:30 PM.

  2. #2
    Join Date
    Feb 2006
    Location
    China
    Posts
    72
    try this

    Code:
    <link rel="stylesheet" href="css/global.css" type="text/css">
    <link rel="stylesheet" href="css/navbar.css" type="text/css">
    what is @import!!!!!

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,224
    Quote Originally Posted by sleven
    try this

    what is @import!!!!!
    http://www.w3.org/TR/CSS21/cascade.html#at-import
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,224
    Use an absolute path instead of a relative path. Either of these options should do the job:
    [code]
    <style type="text/css">
    @import url(/css/global.css);
    @import url(http://www.yoursite.com/css/navbar.css);
    </style>
    [/color]
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles