[advanced search]
11 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 12-26-2006, 12:01 PM   · #1
suhithar
NamePros Regular
 
suhithar's Avatar
 
Trader Rating: (14)
Join Date: Mar 2006
Posts: 223
NP$: 163.00 (Donate)
suhithar is a jewel in the roughsuhithar is a jewel in the roughsuhithar 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


Please register or log-in into NamePros to hide ads
__________________
| SuHi.info | NetSuhi.com |
suhithar is offline   Reply With Quote
Old 12-26-2006, 12:06 PM   · #2
cyberoptik
NamePros Regular
 
Name: Ron
Location: Chicago Burbs
Trader Rating: (40)
Join Date: Aug 2003
Posts: 941
NP$: 0.01 (Donate)
cyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of light
Very useful thanks.
__________________
Chicago Web Design
cyberoptik is offline   Reply With Quote
Old 12-26-2006, 12:10 PM   · #3
suhithar
NamePros Regular
 
suhithar's Avatar
 
Trader Rating: (14)
Join Date: Mar 2006
Posts: 223
NP$: 163.00 (Donate)
suhithar is a jewel in the roughsuhithar is a jewel in the roughsuhithar is a jewel in the rough
Glad I could help
__________________
| SuHi.info | NetSuhi.com |
suhithar is offline   Reply With Quote
Old 12-26-2006, 01:10 PM   · #4
RickM
www.RickyMills.com
 
RickM's Avatar
 
Name: Rick Mills
Location: Herts, UK
Trader Rating: (92)
Join Date: Sep 2005
Posts: 3,529
NP$: 497.52 (Donate)
RickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud ofRickM has much to be proud of
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
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";
?>
RickM is offline   Reply With Quote
Old 12-26-2006, 01:40 PM   · #5
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,800
NP$: 54.00 (Donate)
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   Reply With Quote
Old 12-26-2006, 01:45 PM   · #6
suhithar
NamePros Regular
 
suhithar's Avatar
 
Trader Rating: (14)
Join Date: Mar 2006
Posts: 223
NP$: 163.00 (Donate)
suhithar is a jewel in the roughsuhithar is a jewel in the roughsuhithar is a jewel in the rough
Thanks for the help guys!
__________________
| SuHi.info | NetSuhi.com |
suhithar is offline   Reply With Quote
Old 12-26-2006, 02:06 PM   · #7
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
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');

...would be better as we do not variables names to be expanded. Now that's being picky lol
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline   Reply With Quote
Old 12-26-2006, 02:53 PM   · #8
Dan
Buy my domains.
 
Dan's Avatar
 
Name: Dan
Trader Rating: (63)
Join Date: Feb 2006
Posts: 2,800
NP$: 54.00 (Donate)
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');
Those extra 3 bytes were killer.
Dan is offline   Reply With Quote
Old 12-26-2006, 03:04 PM   · #9
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
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.
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline   Reply With Quote
Old 12-26-2006, 10:31 PM   · #10
jdk
DNOA Member
 
jdk's Avatar
 
Location: USA
Trader Rating: (38)
Join Date: Jul 2004
Posts: 1,116
NP$: 176.10 (Donate)
jdk is a glorious beacon of lightjdk is a glorious beacon of lightjdk is a glorious beacon of lightjdk is a glorious beacon of lightjdk is a glorious beacon of lightjdk is a glorious beacon of light
Why not just do?

PHP Code:
Copyright &copy; 1995 - <?php echo date("Y");?>
jdk is offline   Reply With Quote
Old 12-27-2006, 04:54 AM   · #11
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
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.
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline   Reply With Quote
Old 12-28-2006, 09:58 AM   · #12
jerometan
NamePros Regular
 
Trader Rating: (39)
Join Date: Feb 2006
Posts: 588
NP$: 1540.95 (Donate)
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 all
If those bytes really matter :P, this will work for PHP 5+ :

PHP Code:
Copyright &copy; 1995 - <?=date("Y");?>
jerometan is offline   Reply With Quote
Old 12-28-2006, 11:32 AM   · #13
Matthew.
Stud Sausage
 
Location: England
Trader Rating: (25)
Join Date: Dec 2006
Posts: 1,545
NP$: 32.41 (Donate)
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
__________________
My NamePros Tools
(firefox plugin, google gadget etc)
Matthew. is offline   Reply With Quote
Old 01-20-2007, 03:22 PM   · #14
Stitch
NamePros Member
 
Trader Rating: (7)
Join Date: Dec 2006
Posts: 141
NP$: 0.00 (Donate)
Stitch is on a distinguished road
wow LOL this site has some picky people lol
Stitch is offline   Reply With Quote
Old 01-20-2007, 03:57 PM   · #15
shockie
Senior Member
 
shockie's Avatar
 
Trader Rating: (53)
Join Date: Dec 2006
Posts: 2,851
NP$: 1127.20 (Donate)
shockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud ofshockie has much to be proud of
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
Name Users - Free Revenue Sharing! Weekly Live Domain Auctions!
Cheap Web Hosting - 99.9%+ Uptime, cPanel, Fantastico, Only $2
[sig space for rent]
shockie is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Arcade Script http://www.mobisitetrader.com/ Buy Flash Arcade Game Script
Advertise your business at NamePros
All times are GMT -7. The time now is 11:52 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0