Show a "Comments(x)" text (html)

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
Manuel777
Posts: 2
Joined: Tue Jun 08, 2010 12:05 pm

Show a "Comments(x)" text (html)

Post by Manuel777 »

Hi everyone, im including the script into my website, but im looking for a way to show a text ( in the main indx.htm page ) that shows the number of comments made into a post, ive tried the next code:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>

<?php
define('IN_SCRIPT',true);
require('settings.php');
$lines = file($settings['logfile']);
$total = count($lines);
echo $total;
?>

</body>
</html>
but that doesnt work if im using a .htm, only if i use .php


-Manuel777
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

It's because you can't include PHP code in a HTML file (unless you set server to treat .htm files as PHP which I don't recommend). For PHP code to work the file extension needs to be .php.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Manuel777
Posts: 2
Joined: Tue Jun 08, 2010 12:05 pm

Post by Manuel777 »

Alright! i changed the extension of the main index.htm to .php and everything works now! thanks a lot :D
Post Reply