Forum Moderators: coopster

Message Too Old, No Replies

include or virtual include: neither work for subfolders

         

noobtime

1:28 am on Aug 17, 2005 (gmt 0)

10+ Year Member



my includes files are all in my /ssi directory. I have many subfolders that call those includes files. Let's say I have a file like this:

/news/world/asia/thailand/index.php

In order to (relatively) call a file in the /ssi directory I have to use the following code:

<?php
include ("../../../../ssi/html-lang.htm");
?>

This is ridiculous. Everytime I make a new subfolder I don't want to have to add "../" to it. I heard about "virtual" includes but I'm not sure the syntax I'm using is correct (all I do is put 'virtual' after 'include'). Is there something I'm missing? Do I have to change the .htacess file? Help me please I'm going crazy. I don't want to resort to absolute referencing...

R e b r a n d t

6:33 am on Aug 17, 2005 (gmt 0)



I'am not 100% sure, but this might help:
use ini_set('include_path','/ssi'); in your header script file, so all your scripts can include files by using same system: include('inc.php'); // where inc.php is /ssi/inc.php

noobtime

3:11 pm on Aug 17, 2005 (gmt 0)

10+ Year Member



thought I'd get more replies...well thanks for the guy who did...that didn't work unfortunately...when i put that in the head it displayed it in the body for some reason. I'm about to switch to using ASP cuz I know <!--#include virtual="/ssi/index.asp" --> works like a charm.

coopster

8:42 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, noobtime.

Have a look at this related thread ... sounds like the same question.

[webmasterworld.com...]