+ Reply to Thread
Results 1 to 4 of 4

Thread: SSI & Php include

  1. #1
    tillabong is offline x10Hosting Member tillabong is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    60

    SSI & Php include

    hi im new to web designing. i've created a website with multiple sub-folders. for all the webpages i have a navigation bar which contains images.

    i've tired using SSI to link the navigation.shtml file but didnt work. php include worked for me. however the images dont appear correctly since the links are different for each folders and subfolers.

    for example, www.mywebsite.com/navigation.php is where i've kept the navigation. www.mywebsite.com/images/ is where i kept the images in the navigation. webpages that are within the top most folder will display the images correctly when i link the navigation file.

    however for webpages like www.mywebsite.com/animals/red/green.php if i link the navigation files the images wont appear since the direct links to the images are not correct. is there any way i could use one navigation file and link to all webpages in different subfolers? or do i have to create a similar navigation and images folder and place it in all subdfolders so the links to the images will work?

    sorry correct me if im wrong. external css links images relative to the css files itself and not from the file that contains the external css file. and php include and ssi does otherwise right?

    sorry it may sound a little confusing. really hope someone could help me clarify this.

    thanks alot.



    Edit:
    sorry i've got another doubt if a file has the link logout.php it is a relative link to where the file is. if the link is /logout.php the link becomes relative to the root folder? cause if i add the / in front all the image link in my navigation file the problem is solved and all the images work fine when i link it to any file in any subfolder.

    sorry for all the trouble.
    Last edited by tillabong; 02-22-2010 at 03:18 AM. Reason: Automerged Doublepost

  2. #2
    scc123 is offline x10Hosting Member scc123 is an unknown quantity at this point
    Join Date
    Feb 2009
    Posts
    18

    Re: SSI & Php include

    Could you put navigation.php in public_html?
    Then when you include just use include('/navigation.php'); and that should include it...
    Don't quote me on that though xD

  3. #3
    misson is offline Community Advocate misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,391

    Re: SSI & Php include

    @tillabong: it's not entirely clear from your post where the problem lies. When applicable, you should always post a code sample (a minimal test case) to clarify. Also, there's no need to make up URLs. You're asking about your site, so why not simply post the URL for a live page?

    One thing to keep in mind is that SSI and PHP are server side, while HTML, CSS are client side. As a consequence, any paths used in HTML or CSS are URL paths, while server side functions (with the notable exceptions of the SSI #include virtual command and PHP's virtual()) use filesystem paths. Each kind of path has a different root. URL paths get translated to filesystem paths, but that doesn't matter much here.

    The thread "php include - above root directory" has some nformation about the include and include_once PHP functions. The PHP documentation for these functions has yet more info. Read that over and see if it clears up your confusion.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  4. #4
    tillabong is offline x10Hosting Member tillabong is an unknown quantity at this point
    Join Date
    Jun 2009
    Posts
    60

    Re: SSI & Php include

    sorry so much for the trouble and confusion. i've solved it.

    thank you very much for your replies.

+ Reply to Thread

Similar Threads

  1. PHP Url Include
    By vwd2009 in forum Free Hosting
    Replies: 3
    Last Post: 05-23-2009, 12:23 PM
  2. PHP Include, file help!
    By stillDOLL in forum Programming Help
    Replies: 8
    Last Post: 10-07-2008, 05:26 AM
  3. PHP and new accounts
    By idani in forum Free Hosting
    Replies: 1
    Last Post: 09-21-2008, 02:49 PM
  4. include php within javascript
    By thezone1 in forum Programming Help
    Replies: 5
    Last Post: 04-24-2008, 01:50 PM
  5. php include is this possible
    By nahsorhseda in forum Programming Help
    Replies: 5
    Last Post: 12-28-2007, 01:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers