PDA

View Full Version : PHP include in html doesn't work...



ZoltanWarrior
December 23rd, 2004, 07:03
Hi all,

I've been trying to call a news headline (.txt) in a html page, but SSI include doesn't work for me. So I've tried the following in php:

<? include ("http://www.mydomain.co.uk/newsline.php"); ?>

in the html file and I keep the newsline.php in the root containing the following:

<?php
echo "Stephen spent a week in Tokyo in October 2004. As a part of the filming Stephen was taken for a helicopter ride over the city...";
?>

I've also tried to place the .php file in /include directory but nothing appears where is should be.

Do you have any idea?

Thank you for your help,

Z

aki
December 23rd, 2004, 07:17
why not rename the page from index.html to index.php ?
html doesn't support include (as i know)

and the include tag : <? include ("http://www.mydomain.co.uk/newsline.php"); ?>

newsline.php is in you root folder too ? if yes , you don't have to type http://www.
you only need <? include 'newsline.php'; ?> and the newsline.php must be in the same folder as index.php.

FFDreamling
December 23rd, 2004, 11:09
place the following code into ur .htaccess file:


AddType application/x-httpd-php .php .htm .html .shtml
AddType text/x-server-parsed-html .php .htm .html .shtml

Now you can use PHP/SSI in .html files. (It gets parsed)

ZoltanWarrior
December 23rd, 2004, 11:19
I have about 30 pages where I'd like to include headlines (all the same from one file) therefore I guess the SSI would be rather simple solution.

Thank you for your kind help guys.

Z

aki
December 23rd, 2004, 11:36
hey can you post the website so we can check it? i am not following what ur prob :p

ZoltanWarrior
December 23rd, 2004, 12:37
http://www.stephenwiltshire.co.uk

The news on the left hand side should be edited separately, at the moment I need to update every single page to change the news.

aki
December 23rd, 2004, 12:39
pls change from html to php. include will not support html. if u change the html to php it will be ok

ZoltanWarrior
December 23rd, 2004, 12:41
Thanks, as soon as I get home from work, first thing will be that

aki
December 23rd, 2004, 12:43
ok, just reply and see what we can do for you :D

ZoltanWarrior
December 23rd, 2004, 20:59
That is just perfect. This would be my first website and as I go along learn a lot. I will replace all the repetitions with a simple 'include' .
One some pages I've got some encrypted text, do I risk anything to keep it within the html code or it is a form of suicide?

aki
December 23rd, 2004, 21:12
did you solve the include prob now?

as i understand is php is "almost" same as html, the it generate html code from php tol html. so if you look in the website source code, you will not see the php code like echo or include. so i don't think u have to worry. incase, load the page that contains encrypt text and open source code to check it :D

ZoltanWarrior
December 24th, 2004, 07:22
The code is a part of a html page within a form as a link, therefore you may see it when you check the source.
What I think can do is keep those pages on an SSL server. That might be the best idea.

Thanks,

Z

ZoltanWarrior
December 27th, 2004, 19:02
Perfect, everything is working properly.

Thanks for your help

Z

aki
December 27th, 2004, 19:13
hehe, nice to see you solved the prob. :D