Re: Putting php code into html
- From: "d43m0n AT shaw DOT ca" <barryd.it@xxxxxxxxx>
- Date: 27 Nov 2006 12:58:53 -0800
HTML will not preprocess PHP Code, you will require a webhost, whos
enstead of just sending HTML code, it processes php on the webserver.
For example:
http://example.com/index.php
if the page is written in php, and was to echo Hello World, this is
what it would look like:
<?php
echo 'Hello World';
?>
The client would not see the code, instead they will find a single
line, consisting of 11 characters, including 1 space.
Hello World
Now, if that simple little experiment does not work, then perhaps the
application or your host does not provide addiquet services, including
the php preprocessor.
You can maintain a counter, simple by having a text document hold the
last known users accessing your page. To do this, the code should look
like this.
<?php
$visits = @file('visit_count.log');
$handle = fopen('visit_count.log', 'w');
if (is_null($visits)) {
fwrite($handle, '1');
}
else {
$visits = $visits++;
fwrite($handle, $visits);
}
echo 'You are the number ' . $visits . ' to come to this web page.
Congrads and have a happy existence.' . "\n";
?>
Denis wrote:
How do you include a php counter into a html page. I've tried <?php
include ("counter.php"); ?> but it won't work. any suggestions
.
- References:
- Putting php code into html
- From: Denis
- Putting php code into html
- Prev by Date: Putting php code into html
- Next by Date: Re: [PHP] Tidy HTML source?
- Previous by thread: Putting php code into html
- Next by thread: Re: Putting php code into html
- Index(es):
Relevant Pages
|