Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

quick help with "include" statement

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

quick help with "include" statement

Postby psychomantum » Sat Dec 07, 2002 8:08 pm

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
psychomantum
New php-forum User
New php-forum User
 
Posts: 10
Joined: Sat Dec 07, 2002 8:04 pm

Postby Oleg Butuzov » Sun Dec 08, 2002 12:50 am

config your Apache server or use anther name as like menu.inc.php
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Re: quick help with "include" statement

Postby wiredme » Sun Dec 08, 2002 10:04 pm

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
wiredme
New php-forum User
New php-forum User
 
Posts: 7
Joined: Sun Dec 08, 2002 9:02 pm

Postby PaulG » Thu Dec 12, 2002 10:36 am

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
PaulG
New php-forum User
New php-forum User
 
Posts: 8
Joined: Wed Nov 27, 2002 12:18 pm
Location: London


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron