Guest Posted January 8, 2003 Share Posted January 8, 2003 Beggining of the year and the copyright notice on your site is out of date. Copyright 2000-2002 for example, you may have the date just on one page or you may have to change loads of hard coded dates at the beggining of each year. Well heres a quick and easy way of letting it do it automatically! In PHP: Copyright © 1998-<?=date('Y')?> In ASP (vb script: document.write('Copyright © 1998-' + (new Date()).getFullYear()); I cant take credit for this, it came from the sitepoint newsletter which you can find and sign upto here if you wish.http://www.sitepoint.com/newsletter Im not affiliated I just thought I would share it with you all :) Hope that helps Link to comment Share on other sites More sharing options...
burt Posted January 8, 2003 Share Posted January 8, 2003 Very good tip.. In PHP: Copyright © 1998-<?=date('Y')?> Hate to be so picky :? but if you use short tags as above, then you will have problems if you ever come to use XML...also if you ever change host, and that host has short_open_tag = Off in php.ini, your PHP aint gunna work... Always try to get in the habit of doing: <?php echo date('Y'); ?> As this will save future headaches. HTH Link to comment Share on other sites More sharing options...
Guest Posted January 8, 2003 Share Posted January 8, 2003 Ok, Thanks for that, im useless at php and still learning the basics, as i said the above was not by me, but from somewhere else. Thanks for putting me in the picture though, even through my mistakes i can help others :D :lol: God im good ;) Link to comment Share on other sites More sharing options...
GD Posted January 15, 2003 Share Posted January 15, 2003 Hey Paul and Gary, Thanks for the PHP code. I use it on my site to change the date and it works great. 8) I've uploaded a mod package: http://www.oscommerce.com/community/contributions,884 Don't worry, you both get the credit! :wink: Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet! Link to comment Share on other sites More sharing options...
GD Posted January 15, 2003 Share Posted January 15, 2003 Oh, I forgot to say, I put it up in the contributions area, because a lot of people will never see this topic. Anyway, thanks again. Small things, sometimes help in a big way. Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet! Link to comment Share on other sites More sharing options...
mattice Posted January 15, 2003 Share Posted January 15, 2003 Thanks for the PHP code. I use it on my site to change the date and it works great. Now now GD... You don't know for sure untill 2004 now do you? :D "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
Ian Posted January 15, 2003 Share Posted January 15, 2003 Also isn't there another date when millenium type bug kicks in. 2019 seems to ring bell. Or maybe I'm thinking of 2012 when the Mayan calendar ( or was that nostradamus) predicts the end of the world. I don't suppose the fact that isCommerce still works will matter much in that case. :D Trust me, I'm an Accountant. Link to comment Share on other sites More sharing options...
GD Posted January 15, 2003 Share Posted January 15, 2003 Who says we'll still be here tomorrow for that fact? To everyone, I apologize for my haste in thinking this code would be a good thing. I was feeling okay, now after the last posts I've checked the site and updated the date forward to 2004-2020, the date DID NOT change on the page I used the PHP code. I'm now suggesting that, this mod should not be used. SORRY! :oops: I'm always looking for better ways to do less code hacking, but I always end up having to do it the original time consuming way. Thanks you guys for pointing out the limitations of the code. Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet! Link to comment Share on other sites More sharing options...
burt Posted January 15, 2003 Share Posted January 15, 2003 Did you update the server date ? That code works for sure as I use it on *all* sites I build, Oscommerce or not... Link to comment Share on other sites More sharing options...
Guest Posted January 15, 2003 Share Posted January 15, 2003 Erm, If the only problem is that the mod will not work in 2020, then I suggest that still gives 18 yrs of good use!! I used this bit of code and it changed everything, to this years date no problem, i presumbe it takes the date from the server, so if your server date is changed then the date will be updated, did you change the server date? Does anybody else find any problems with this code! Link to comment Share on other sites More sharing options...
GD Posted January 16, 2003 Share Posted January 16, 2003 Hi Gary and Paul, Did you update the server date? No. My site is hosted and I do not have access to that function. I changed the date on my PC forward, as I've done before to test out JavaScript code which contain time and date based features. This is how I tested the code supplied. I did not mean to open a big can of worms here, but if you would like, I suggest one of you update the contribution download page to show your views on the use of the mod or maybe not. http://www.oscommerce.com/community/contributions,884 I cannot take a chance, that the hack won't be working in a year or two from now. Having to update and/or remove many instances of the code throughout my site. Sorry :oops: Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet! Link to comment Share on other sites More sharing options...
Snowman Posted January 16, 2003 Share Posted January 16, 2003 Um i hate to rain on anyones parade but i actually contributed this a couple of weeks ago. http://www.oscommerce.com/community/contributions,862 Nice quick and simple and ties in with the osCommerce code easily. Link to comment Share on other sites More sharing options...
mattice Posted January 16, 2003 Share Posted January 16, 2003 :shock: Relax GD... the date('Y') will work on 99,9% of all the php enabled systems... Ian and I were just joking.. If you want to get creative look here: http://www.php.net/date And Snowman... Bet it took you more time writing the doc ;) "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
GD Posted January 16, 2003 Share Posted January 16, 2003 Hi snowman, I did not see your contribution. Your post was under the credit modules section and I posted under the Other section. I'm personally, just going to go ahead and do all the date updates when needed. :wink: Good luck Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet! Link to comment Share on other sites More sharing options...
Snowman Posted January 16, 2003 Share Posted January 16, 2003 Doh...theres those stupid pills again :oops: And yeah i think it did take longer to right the doc than the mod itself. :lol: Link to comment Share on other sites More sharing options...
burt Posted January 16, 2003 Share Posted January 16, 2003 No. My site is hosted and I do not have access to that function.PHP is server side, so changing your date locally wont make any difference as you now know ;) I cannot take a chance, that the hack won't be working in a year or two from now. Having to update and/or remove many instances of the code throughout my site. The hack will work fine. Do the changes and forget about it until 01/01/2004. Link to comment Share on other sites More sharing options...
GD Posted January 17, 2003 Share Posted January 17, 2003 Thanks Mattice for the link. Too much information, I'm going to leave that alone. And to everyone else, my apologies all around. :oops: I should know when to go to bed and leave the code alone. :wink: This item for me is closed. Thanks Burt, PHP is server side, so changing your date locally wont make any difference as you now know Now I know for the future, when testing out PHP scripts. Running osC - 2.2MS2. P.S. Please don't ask for a link to my site, it is on a production server and not available for the general public, yet! Link to comment Share on other sites More sharing options...
Guest Posted February 6, 2003 Share Posted February 6, 2003 Just a little addition to my first post, this again comes from the same newsletter I mentioned in the first post of this thread, and so I am not taking any credit for it. Basically if you ever get a job where the customer doesnt want to use a server side programming language, basically it can also be done with the SSI tags. like this <!--#config timefmt="%Y"-->Copyright © 1999 - <!--#echo var="DATE_LOCAL"--> and you get: Copyright ? 1999 - 2003 HTH Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.