NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page Auto Update Copyright [PHP]

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 12-26-2006, 12:01 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
Ryder's Avatar
Join Date: Mar 2006
Posts: 227
Ryder is a jewel in the roughRyder is a jewel in the roughRyder is a jewel in the rough
 



Auto Update Copyright [PHP]


Have you ever made a site and always had to change the copyright? Well you came to the right place!

Here is a PHP code which will automatically update to the current year

<?PHP $date = date('Y'); echo ("Copyrighted 1950 - $date"); ?>

What that script does it, it outputs the current date!

More tutorials coming soon at:
http://www.netsuhi.com
__________________
| HexRde.com | NetSuhi.com |
Ryder is offline  
Old 12-26-2006, 12:06 PM   #2 (permalink)
Senior Member
 
cyberoptik's Avatar
Join Date: Aug 2003
Location: Chicago Burbs
Posts: 1,111
cyberoptik has much to be proud ofcyberoptik has much to be proud ofcyberoptik has much to be proud ofcyberoptik has much to be proud ofcyberoptik has much to be proud ofcyberoptik has much to be proud ofcyberoptik has much to be proud ofcyberoptik has much to be proud of
 


Breast Cancer
Very useful thanks.
__________________
Website Scripts - The Best Scripts on the Web
Follow Scripteen on Facebook!

Join the Scripteen Mailing List for exclusive script discounts & updates!
cyberoptik is offline  
Old 12-26-2006, 12:10 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
Ryder's Avatar
Join Date: Mar 2006
Posts: 227
Ryder is a jewel in the roughRyder is a jewel in the roughRyder is a jewel in the rough
 



Glad I could help
__________________
| HexRde.com | NetSuhi.com |
Ryder is offline  
Old 12-26-2006, 01:10 PM   #4 (permalink)
Senior Member
 
RickM's Avatar
Join Date: Sep 2005
Location: Herts, UK
Posts: 3,806
RickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant futureRickM has a brilliant future
 


Cancer Survivorship Save The Children Save The Children Cancer Animal Cruelty Child Abuse Cancer Survivorship 9/11/01 :: Never Forget Animal Cruelty Child Abuse Animal Rescue Animal Cruelty Protect Our Planet Protect Our Planet Protect Our Planet Animal Cruelty Save a Life
Just a note, you don't need brackets round echo tags in php4+

e.g:

PHP Code:
<?php 
$date
=date('Y');
echo
"Copyrighted 1950 - $date";
????: NamePros.com http://www.namepros.com/code/273451-auto-update-copyright-php.html
?>
__________________
Disney World Fans - Mobile Apps for your WDW Vacation!
WSDReg - Affordable Domain Registration. Serving NP members since 2006!

Hotel Site Script - 15% Discount for NP members with code 'NPROS'
RickM is offline  
Old 12-26-2006, 01:40 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
PHP Code:
<?php echo "Copyright &copy; 1950 - " date("Y"); ?>
Dan is offline  
Old 12-26-2006, 01:45 PM THREAD STARTER               #6 (permalink)
NamePros Regular
 
Ryder's Avatar
Join Date: Mar 2006
Posts: 227
Ryder is a jewel in the roughRyder is a jewel in the roughRyder is a jewel in the rough
 



Thanks for the help guys!
__________________
| HexRde.com | NetSuhi.com |
Ryder is offline  
Old 12-26-2006, 02:06 PM   #7 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
rmwebs, i don't think it is since php4. echo is and also has been a language construct which do not require parenthesis. To my knowledge is it not version dependent.

Dan, now you're just being picky lol!

technically....
PHP Code:
echo 'Copyright &copy; 1950 - ' date('Y'); 
????: NamePros.com http://www.namepros.com/showthread.php?t=273451
...would be better as we do not variables names to be expanded. Now that's being picky lol
Matthew. is offline  
Old 12-26-2006, 02:53 PM   #8 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,792
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
PHP Code:
echo'Copyright &copy; 1950 - '.date('Y'); 
????: NamePros.com http://www.namepros.com/showthread.php?t=273451
Those extra 3 bytes were killer.
Dan is offline  
Old 12-26-2006, 03:04 PM   #9 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
touché Dan.
Matthew. is offline  
Old 12-26-2006, 10:31 PM   #10 (permalink)
jdk
Senior Member
 
jdk's Avatar
Join Date: Jul 2004
Location: Florida
Posts: 1,496
jdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond reputejdk has a reputation beyond repute
 



Why not just do?

PHP Code:
Copyright &copy; 1995 - <?php echo date("Y");?>
jdk is offline  
Old 12-27-2006, 04:54 AM   #11 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
Originally Posted by jdk
Why not just do?

PHP Code:
Copyright &copy; 1995 - <?php echo date("Y");?>
I think it was assumed that the lines previous to this one would have been in php hence you would not bother with the advantages of breaking out of php to output and simply echo it as it is only 1 line.
Matthew. is offline  
Old 12-28-2006, 09:58 AM   #12 (permalink)
NamePros Regular
Join Date: Feb 2006
Posts: 584
jerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to alljerometan is a name known to all
 



If those bytes really matter , this will work for PHP 5+ :

PHP Code:
Copyright &copy; 1995 - <?=date("Y");?>
jerometan is offline  
Old 12-28-2006, 11:32 AM   #13 (permalink)
Senior Member
Join Date: Dec 2006
Location: England
Posts: 1,565
Matthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud ofMatthew. has much to be proud of
 


Adoption Breast Cancer Breast Cancer Cancer Survivorship
Let us think of compatibility jromentan! What if short_open_tag is disabled lol.

Anyway, that will work for all versions of php, not just php5+. Also it can be beaten lol! Remember just how important those bytes ares

PHP Code:
 Copyright &copy; 1995 - <?=date("Y")?>
The closing tag (?>) also adds a semi colon, so you don't have to
Matthew. is offline  
Old 01-20-2007, 03:22 PM   #14 (permalink)
NamePros Member
Join Date: Dec 2006
Posts: 138
Stitch is on a distinguished road
 



wow LOL this site has some picky people lol
Stitch is offline  
Old 01-20-2007, 03:57 PM   #15 (permalink)
Senior Member
 
shockie's Avatar
Join Date: Dec 2006
Posts: 4,702
shockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond reputeshockie has a reputation beyond repute
 



Originally Posted by . Adam .
wow LOL this site has some picky people lol
i know eh?... and i thought the cost of bandwidth was going down!! good job though guys; striving for excellence is enviable.
__________________
- shockie
shockie is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 03:20 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger