Forum Moderators: not2easy
If I want to present the outcome of some basic php within my main css page, how do I get it to work?
The basic php which works (without any CSS):
<?
$currentdate = getdate(time());
echo "© Mysite ".$currentdate["year"];
?>
The basic php contained in CSS:
<div id="copyright">
<?
$currentdate = getdate(time());
echo "© Mysite ".$currentdate["year"];
?>
</div>
Or do I need to include a purpose built css.inc file within the php - doh!
Thanks. . . .
you need also to verify in your php.ini that your short tags is "on"
if not this <? .. script?> will generate an error
You are not telling us what is your file extension
if your file is not a "dot"PHP then you need to set your httpd.conf to parse php within html
if this is getting to be a PHP thread you should ask the CSS mod to move your thread to PHP
Have fun :)
consider that the php code generates html that is sent to the browser, the css will act on the html code.
so in your case, something like this will be sent to the browser:
<div id="copyright"> © Mysite 2007 </div>
the fact that you created the html server side using php is completely irrelevant, assuming that you have set an id named copyright in your style sheet or in the head of the page it will render the style correctly.
The solution was pretty straightforward. I should have asked 'how to parse php via a dot html page.' The solution is to write:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
into my dot htaccess file.
Thanks again for your help.
W.