Php Includes - Help please?

Php Includes - Help please?

Posted by: sardonic
Posted on: 2005-09-09 22:33:00

Okay, so I feel rather stupid but I've read tutorials on using php includes and I can get my main index page to work using php includes but I can't do it with any other pages because they are in different files. Could someone please tell me what path I need to put in so that it will work with files in other folders?

I tried this but it didn't work:
? include("/home/sardonic/sardonicmisfit.net/topmain.php"); ?
For my index.php page I just put
? include("topmain.php") ?
and it works fine. Could someone please help? I'm really confused even though I know it's very simple. Thanks.


Re: Php Includes - Help please?

Posted by: Atropos7
Posted on: 2005-09-09 22:40:00

Try using

<?php include($_SERVER['DOCUMENT_ROOT']."/topmain.php"); ?>



cool Perl / MySQL / HTML+CSS

Re: Php Includes - Help please?

Posted by: sardonic
Posted on: 2005-09-10 00:48:00

OH MY GOODNESS. Nevermind, it wasn't the php that was wrong! Nevermind, I was just having a major blonde moment. Thanks for your help :)

Edited by sardonic on 09/10/05 00:56 AM (server time).

Tags: php includesmain indexhelpfoldersconfusedstupidpath