|
Posted by Julien Plιe on 08/12/07 15:26
Le Wed, 08 Aug 2007 18:00:39 +0000, nospam a Γ©critΒ :
> Hello,
>
> Sorry for the newbie question. I am trying to add some dynamic content
> to an existing HTML page. I would like to add a random saying to an
> area of a HTML doc. Sort of like a "fortune" - that would display a
> different fortune every minute.
>
> I figure that I can write a PHP script to select a random fortune from a
> file, but how do I embed that text within a HTML doc.I want to keep the
> HTML document just as it is now but add this php text. I don't want to
> rename MyHtml.html to MyHtml.php which I can do now.
>
> Is there a way to execute a external php script from within an HTML and
> have its return value displayed in the HTML?
>
> Thanks in advance,
> bruce
Hello Bruce,
You could embed it in a script tag referencing an external PHP file which
would generate ECMAScript for displaying your fortune sentences. The
counter part is that you will be able to display only few of them.
You're second choice could be to use AJAX based programming. This way,
you would be able to tell JavaScript to retrieve a sentence every X
minutes to display it.
Whatever you choose, you will have to use JavaScript if you don't want
your file to be parsed in PHP.
Julien
Navigation:
[Reply to this message]
|