Page 1 of 1

quick help with "include" statement

Posted: Sat Dec 07, 2002 8:08 pm
by psychomantum
I'm fairly new to PHP and I'm trying to include a navagation menu on a site I am doing. I coded the menu.inc file and tried to include it on all my pages with this code:

Code: Select all

<?php 
include("menu.inc");
?>


when I visit the page, I still see the php code and not the menu. I know that php works on my site because I have a messege board and guestbook set up with it. Am I missing something?

Also the directory and files are chmoded to 755

thanks

Posted: Sun Dec 08, 2002 12:50 am
by Oleg Butuzov
config your Apache server or use anther name as like menu.inc.php

Re: quick help with "include" statement

Posted: Sun Dec 08, 2002 10:04 pm
by wiredme
psychomantum wrote:I'm fairly new to PHP and I'm trying to include a navagation menu on a site I am doing. I coded the menu.inc file and tried to include it on all my pages with this code:

Code: Select all

<?php 
include("menu.inc");
?>


when I visit the page, I still see the php code and not the menu. I know that php works on my site because I have a messege board and guestbook set up with it. Am I missing something?

Also the directory and files are chmoded to 755

thanks


it might be a problem with your menu.inc .... try saving it menu.php


or follow this : in you index.php
<?
include "menu.inc";
?>

in you menu.inc like this
<?
echo "<a href=link.html>nav1</a>";
?>


thats it..hope it helps you a lot


bye :D :D

Posted: Thu Dec 12, 2002 10:36 am
by PaulG
How have you coded your menu.inc file?
:idea: Remember that an included file needs the <?php and ?> tags if you're using php code - all included or required files are as html by default.
So, if your menu file contains php code without the php tags, the browser will show the code itself.

Good Luck