FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Referencing a php file





guitarcrazy087
ok, so right now i'm using an external file for a menu, and am liking to it using php, so i only have to edit one file for all my pages and the menu will change on all of them. here's the directory set up

-Root directory-
Index.php
Menu.php
-sub-folder: Blog
Index.php

so how do i link the index.php in the blog folder to teh menu.php in the root directory? if i use a full url it doesn't work. just a bunch of warnings come up. this is the php i'm using to reference it:

<?php include("http://joehenry.frihost.net/menu.php"); ?>

thanks is advance for your help. Very Happy
sonam
Post the warnings what you get, and before you can try to change your code in:

Code:
<?php include("../menu.php"); ?>


Sonam
guitarcrazy087
Hey thanks for your help. the ../menu.php worked.
thanks again!
guitarcrazy087
hey there. i have a problem that i have no clue how to fix...

i have this set up in a php doc:

<?php include("headertop.php"); ?>

<title>Joe Henry- home</title>

<?php include("headerbottom.php"); ?>


content

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

<?php include("footer.php"); ?>

it works perfectly except it sticks a space at the top of the page. if i past the code from the the php docs into my page, it works fine. it's just when i use the include it sticks a space there...any ideas?

the page is http://joehenry.frihost.net

the other php document addresses are:

http://joehenry.frihost.net/headertop.php
http://joehenry.frihost.net/headerbottom.php
http://joehenry.frihost.net/menu.php
http://joehenry.frihost.net/footer.php

all that's wrong on the page is that the paint splat on the top of the page should start at the top of the page and it doesn't....so anyway, thanks for your help! Very Happy
rvec
nice design

you could try to put the first and second header file together and do something like this:

In the header files :
Code:
<html>.......
<title><?php echo $title; ?> </title>......
<body>

And in the normal file start like this:
Code:
<?php
$title = 'some title';
include('header');
...
?>
content
...
guitarcrazy087
OK! WOW! your amazing lol. thanks so much! it works perfectly!

again thanks! Very Happy
Related topics
Tutorial: PHP Installed Modules Dynamic Reference Tool
PHP function(); &file=""?
Cron jobs - running a php file
[PHP doubt]Knowing the directory location of PHP file
PHP Test File
is there any way to trigger a .php file without refreshing?
Uploading a .php file! NEED HELP thanks
User Viewing A PHP File
send variable from php tp php file
Limiting php file functions with .htaccess
Remote php file access and reading
including javascript in php file
Hide PHP file extension
[TuT]JOOMLA Installation Guide(Easiest Way)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.