Forum Moderators: coopster

Message Too Old, No Replies

include in DW Templates

PHP dreamweaver include template

         

KiAnKo

9:44 am on May 10, 2007 (gmt 0)

10+ Year Member



In my file "/Templates/template-file_1.dwg.php" I have:

<?php
include '../include/menulist.php';
?>

to include the file "/include/menulist.php".

Since I use this template-file in many different subfolders, it doesn't work except for
"/folder1/file1.php" (since it's the same "tree-level")

and not for
"/file2.php" (root file, less "tree-level")
"/folder2/folder3/file3.php" (one more "tree-level")

I have tried many ways:

include ("@@('/include/menulist.php')@@");
and combinations of:
$_SERVER["DOCUMENT_ROOT"]
$_SERVER["HTTP_HOST"];
require_once

Please help!

(include works in normal files...)

[edited by: KiAnKo at 9:46 am (utc) on May 10, 2007]

adb64

9:54 am on May 10, 2007 (gmt 0)

10+ Year Member



Hi KiAnKo,

Welcome to WebmasterWorld

If you want to use an absolute path (/include/menulist.php) you have to use the full path from the server root. I don't know what it is in your situation, but it might be something like:


/usr/htdocs/yourdomain/html

Ask your hosting provider what the path is in your case.
With this as example the complete absolute include path of your file would become:

include('/usr/htdocs/yourdomain/html/include/menulist.php');

Regards,
Arjan

omoutop

10:03 am on May 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Alternative way - saves you ther trouble of asking your tech support....

$_SERVER['DOCUMENT_ROOT']."/path/to/include/file.php";

If you echo the $_SERVER part, you get to see the path you are asking.

Marcia

10:55 am on May 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you going to use fully meshed navigation, with all the same nav links running throughout all the pages on the entire site?