Forum Moderators: coopster

Message Too Old, No Replies

php code to display date .

         

mike2010

6:44 pm on Mar 29, 2011 (gmt 0)

10+ Year Member



I'm still using an old school code on one of my .html pages to display the current date -

<?php
echo date("F j, Y");
?>


with the following in vhost.conf to get it to work - (on the html page)

AddType application/x-httpd-php .php .html .htm
AddType application/x-httpd-php-source .phps


The problem comes when I try to add

AddType 'text/html; charset=ISO-8859-1' html

to .htaccess

It cancels out the php and the date no longer displays.

Could I get some advice on a more 2011 type approach ?

[edited by: tedster at 10:03 pm (utc) on Apr 29, 2011]
[edit reason] maintenance [/edit]

robzilla

7:42 pm on Mar 29, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you considered using Javascript to display [webmasterworld.com] the time/date [webmasterworld.com], so that you won't even have to call your .html files as php applications?

mike2010

7:54 pm on Mar 29, 2011 (gmt 0)

10+ Year Member



update : bah, I tried it but I went back to the php version....as the javascript version just shows up as javascript code when 'viewing source'. The php version shows the actual date.

any other ideas ?

[edited by: tedster at 10:04 pm (utc) on Apr 29, 2011]
[edit reason] maintenance [/edit]

coopster

4:45 pm on Mar 30, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



AddType 'text/html; charset=ISO-8859-1' html


Use AddCharset [httpd.apache.org].