Reply to Re: Very newbie question (including other php files)

Your name:

Reply:


Posted by Hilarion on 11/10/05 15:38

> Unfortunately it still doesn't work. I've put a cut-down example of this on my website.
>
> The source code is here ...
>
> www.dracan.co.uk/index_test_php.txt
> www.dracan.co.uk/header_test_php.txt
>
> and the actual pages are here ...
>
> www.dracan.co.uk/index_test.php
> www.dracan.co.uk/header_test.php
>
> I'm sure it must be something simple, but I can't for the life of me see what it is.
> Then again, I am extremely new to php.

It is something simple. The problem is in the way you include your header
file. You did it by providing URL, not path to the file. This way the
header file got interpreted (executed) in separate HTTP request (so
no variable value was there) and the interpretation result (pure
HTML) got included into the index file. You should use local path (in terms
of PHP server local path) when including files. In this case (when included
file is in the same folder as the scirpt including it) you can simply
give included file name without any path information:

<?php
$title_string = 'My title string';
include 'header_test.php';
?>

This is the main body<br>
</body>
</html>


Hilarion

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация