busker Posted April 7, 2014 Share Posted April 7, 2014 I'm trying but haven't succeeded in my script below. It checks for a specific date and displays an appropriate cursor. If the date isn't found, it defaults to the cursor of the month. Everything's currently in the root folder so I can see the paths clearly. index.php <style> body {cursor: url("cursor.php"), auto;} </style> cursor.php <?php $date = date("m,d"); $monthly = date('m'); if($date == "04,06"){ echo("moustache.ani"); } elseif($date == "12,25"){ echo("christmas.ani"); } else{ switch ($monthly) { case '04': echo '<"balancing.ani">'; break; } } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted April 7, 2014 Share Posted April 7, 2014 I'm not sure where you got the idea that css's url attribute would parse a php file, but it won't. Quote Link to comment Share on other sites More sharing options...
busker Posted April 7, 2014 Author Share Posted April 7, 2014 (edited) I was hoping it would so I wouldn't have to modify much being that the css is already included on every page. It actually works if you put the cursor's url attribute in the actual page. I was wondering why the source code was coming out a little fonky. Thanks Btw, I was at another php forum that was clueless Edited April 7, 2014 by busker Quote Link to comment Share on other sites More sharing options...
kicken Posted April 8, 2014 Share Posted April 8, 2014 You can reference a PHP file in the css file, but rather than have that script output the name of the cursor you want to use, you need to have it output the actual cursor content with appropriate headers. Figure out what the proper mime type is for the cursor files and output a Content-type header for it, then output the cursor file contents using readfile. Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 8, 2014 Share Posted April 8, 2014 Or, it may even work to use a header() to redirect to the file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.