You are here: Re: Newbie: PHP output within HTML page « All PHP « IT news, forums, messages
Re: Newbie: PHP output within HTML page

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация