oggyswain Posted January 10, 2011 Report Share Posted January 10, 2011 (edited) Hi I have not used php at all, but I saw a script that would save me a bit of time on various website that I handle. But I can't get it to work. Can you help me out. This is the code on my site <td width="675" height="44" align="center" class="footer c5" style="background-image:url(images/bot.gif); vertical-align:middle"><strong>urbanmail.ca</strong> © <?php date.php ?> | <a href="privacy.html">Privacy Policy</a> | <a href="sitemap.html">Sitemap</a> | <a href="contact_us.html">Contact Us</a> |<a href="mailto:info@urbanmail.ca"> info@urbanmail.ca</a><br /> And this is the date.php script I have in my directory © Copyright <?php $then = 2007; $now = date('Y'); if ($then == $now) echo $now; else echo "$then - $now"; ?> What I am trying to have it do is change the year automatically every year. I have also added this to the .htaccess file AddType application/x-httpd-php .html Where have I gone wrong. Edited January 10, 2011 by oggyswain Quote Link to comment Share on other sites More sharing options...
wjohn Posted January 10, 2011 Report Share Posted January 10, 2011 Would you like it to stand like 2007-2011? And next year 2007-2012? <?php echo "2007-" . date("Y"); ?> Would display like above. Quote Link to comment Share on other sites More sharing options...
Andrea Posted January 10, 2011 Report Share Posted January 10, 2011 All you need is this: (you don't need any script) <?php echo date("Y") ?> but the page must be .php, or you need to set your .htaccess to read your html pages as php. Quote Link to comment Share on other sites More sharing options...
oggyswain Posted January 10, 2011 Author Report Share Posted January 10, 2011 All you need is this: (you don't need any script) <?php echo date("Y") ?> but the page must be .php, or you need to set your .htaccess to read your html pages as php. Is there anything else I need to put in the htacess file. besides this AddType application/x-httpd-php .html Because I can't get it to work. Thanks Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 10, 2011 Report Share Posted January 10, 2011 Where are you testing this? On your local computer? On the web hosting? Quote Link to comment Share on other sites More sharing options...
oggyswain Posted January 10, 2011 Author Report Share Posted January 10, 2011 Where are you testing this? On your local computer? On the web hosting? Web Hosting http://urbanmail.ca/why_us.html Bottom of page Quote Link to comment Share on other sites More sharing options...
Andrea Posted January 10, 2011 Report Share Posted January 10, 2011 Is there anything else I need to put in the htacess file. besides this AddType application/x-httpd-php .html Because I can't get it to work. Thanks I am assuming you're uploading files via ftp - not working locally. No idea how you'd do this locally. As to remote - you may have to check with your host, sometimes, they settings they require to make this work are not the 'standard' ones. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 10, 2011 Report Share Posted January 10, 2011 If you can't figure this out, you can do the same thing with Javascript: <script type="text/javascript"> currentTime = new Date() document.write(currentTime.getFullYear()); </script> You've checked that the server supports PHP, correct? And you are running a Linux based server? (.htaccess files won't work on Windows servers) Quote Link to comment Share on other sites More sharing options...
oggyswain Posted January 11, 2011 Author Report Share Posted January 11, 2011 If you can't figure this out, you can do the same thing with Javascript: <script type="text/javascript"> currentTime = new Date() document.write(currentTime.getFullYear()); </script> You've checked that the server supports PHP, correct? And you are running a Linux based server? (.htaccess files won't work on Windows servers) My service provider said It should work but it does not. There not much help. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 11, 2011 Report Share Posted January 11, 2011 I'm really not sure how much more I can help you, short of you PMing me FTP information and I taking a look. Have you tried using the Javascript method above, rather than using PHP? I'm not sure whether your statement "my service provider said it should work but it does not" was referring to the JS or PHP. Quote Link to comment Share on other sites More sharing options...
oggyswain Posted January 11, 2011 Author Report Share Posted January 11, 2011 I'm really not sure how much more I can help you, short of you PMing me FTP information and I taking a look. Have you tried using the Javascript method above, rather than using PHP? I'm not sure whether your statement "my service provider said it should work but it does not" was referring to the JS or PHP. You are brilliant. It worked as javascript. Thanks Quote Link to comment Share on other sites More sharing options...
Wickham Posted January 12, 2011 Report Share Posted January 12, 2011 This raises a question I had some time ago. Why put a date after a copyright notice? I found that some of my old pages had a fixed date which was several years old, so I wondered whether to put a PHP code for the current year, so that even though the page was coded a few years ago the date would be current, or just to leave out the date. Copyright is for ever, isn't it? My websites now have a mixture of current date and no date. A question for those legal people among us. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 12, 2011 Report Share Posted January 12, 2011 As far as I understand it, the minute you put something original online that item is automatically copywritten ( of course, if you were ever to enter a copyright dispute, you would have to be able to prove you were the original creator of the work.) Technically, a date isn't really necessary. 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.
Note: Your post will require moderator approval before it will be visible.