Forum Moderators: mack

Message Too Old, No Replies

Server side include in different directory

How to use the unix in command

         

neveremail

8:19 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



Hi,

i'm currently trying to set up a SSI.

i have some up already working fine e.g:
<!--#include file="in.php"-->

But i need to include a file in a different directory.

The one the program I'm trying to set up advised to use was:

<?php
include($DOCUMENT_ROOT.'/robotstats/robotstats.inc.php');
?>

This does not work as its the wrong type.

I can't use something lik this either::

<!--#include file="http://www.mysite.com/robotstats/robotstats.inc.php"-->

The site i was looking at for help told me to do this:

"The unix ln (link) command allows you to create a entry in a directory that points to a real file located elsewhere on the computer. If you have a file called myfile.txt located in /usr/me/mybookfiles/source you could do this:
cd public_html (or wherever your webpage is located)
ln -s /usr/me/mybookfiles/source/myfile.txt myfile.txt

You will now have a directory entry in the document directory and your include should work just fine! "

I dont know how to do this.

I took a wild guess:

I made robotstats.txt file and pointed the include to that file:

<!--#include file="robotlink.txt"-->

And had this in the text file:

ln -s /home/mysite/public_html/robotstats/robotstats.inc.php robotlink.txt

But it just loaded that text on the webpage and didn't link through.

How do I actually perform this guide. I don't know how to use unix or really what it is.

How do i set this up.

Thanks

Chris

encyclo

8:41 pm on Mar 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are using SSI, then the path is from the document root - so you don't need to specify it as is the case with PHP includes. Have you tried:

<!--#include virtual="/robotstats/robotstats.inc.php" -->

I've never tried including a PHP file with SSI, so I can't be certain of the results.

Symbolic links are commands that you enter on the command line when you are connected to the server via SSH. If you don't have access to the command-line, then you should contact your host. Bear in mind that symbolic links are only functional on Unix-type servers.