Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Present php in CSS Basic but . . . Wonderstuff msg:3238839 9:33 pm on Jan 31, 2007 (gmt 0) Hi Guys
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:
<? $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. . . .
henry0 msg:3238938 11:10 pm on Jan 31, 2007 (gmt 0)
You may handle it as your example is set or keep your PHP file in an includes dir and do an <? include"includes/file.php"; ?>
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 :)
topr8 msg:3238949 11:19 pm on Jan 31, 2007 (gmt 0)
i think you're getting confused.
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.
mep00 msg:3239159 5:37 am on Feb 1, 2007 (gmt 0)
To add to what topr8 said, when writing a style sheet for html pages generated by php you need to anticipate what style you may need. Then, when your php generates the html, include the appropriate ids and classes. Wonderstuff msg:3239810 7:26 pm on Feb 1, 2007 (gmt 0)
Gentlemen thanks for you help. You're an inspiration.
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.