Page Include

I’m new to php and includes. I’m building a large ebook for some friends and will need to update the menu at times.

I’ve built a mega menu using a menu from css3 menus and I’m building the site in expression Web 4. I’ve read tutorials and tried everything but still can’t get it to work. I’m sure it’s me, I just can’t seem to understand how to make everything come together.

I save the menu as menu.php in a folder. I then make a template page and name it temp.php. I was told to add this code to the temp.php page to test it and nothing happens.

<?php include($DOCUMENT_ROOT . "/incudedfiles/menu.php"); ?>

Would someone please tell me what I’m doing wrong and how I need to do this?
Thanks in avance

It’s hard to say what’s in your template without seeing it…

But you have a variable called $DOCUMENT_ROOT - But I don’t see it being set anywhere…

You can try the below to see if it works for you, because where using the $_SERVER which should be available on every page, it should reference you include file.

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

http://php.net/manual/en/reserved.variables.server.php

In addition if you turn on PHP debugging, you’ll get more clues as to what’s going on…

Just add this to the top of your PHP Page.
[php]<?php
ini_set(‘display_errors’, ‘On’);
error_reporting(E_ALL);?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service