Page 1 of 1

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

Posted: Tue Jun 08, 2010 12:42 pm
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

Posted: Tue Jun 08, 2010 1:54 pm
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.

Posted: Wed Jun 09, 2010 7:17 am
by Manuel777
Alright! i changed the extension of the main index.htm to .php and everything works now! thanks a lot :D