Footer copyright date, using php


#1

I recall years ago, seeing several sites use php to display copyright dates for their website/company.

Essentially, each year the copyright date would update accordingly, so you dont forget to update.

Could be as simple as echo current year

Some also echoed version number using php

Just cannot recall what and how they did it, any suggestions ?

Cheers


#2

Yeah, just echo the current year (using the date function) :slight_smile:

echo '© 1998–'.date('Y').' My Company';

Would print:

© 1998-2011 My Company


#3
sevenspark said

Yeah, just echo the current year (using the date function) :slight_smile:

echo '© 1998–'.date('Y').' My Company';

Would print:

© 1998-2011 My Company

Thought it was simple.

Cheers

Did this in the end:

Copyright © 2010 – <?=date("Y", time());?>

#4

As a rule of thumb it’s better to only output dynamic content with php, so

© 1998–<?php echo date('Y'); ?> My Company

would be more appropriate (sorry, I’m just being nitpicky :stuck_out_tongue: ).


#5
theninja said

As a rule of thumb it’s better to only output dynamic content with php, so

© 1998–<?php echo date('Y'); ?> My Company

would be more appropriate (sorry, I’m just being nitpicky :stuck_out_tongue: ).

Honestly I agree with you 100%. I had it typed out that way but was afraid the comments filter was going to garble my PHP tags so I rewrote it in a way I could still get the idea across. Thanks for posting the better way though :slight_smile:


#6
sevenspark said
theninja said

As a rule of thumb it’s better to only output dynamic content with php, so

© 1998–<?php echo date('Y'); ?> My Company

would be more appropriate (sorry, I’m just being nitpicky :stuck_out_tongue: ).

Honestly I agree with you 100%. I had it typed out that way but was afraid the comments filter was going to garble my PHP tags so I rewrote it in a way I could still get the idea across. Thanks for posting the better way though :slight_smile:

Cheers.

My business partner just came in office and suggested that way, I cannot take credit. I am shite at php

Many thanks mate, appreciate your help :slight_smile:


#7
sevenspark said

Honestly I agree with you 100%. I had it typed out that way but was afraid the comments filter was going to garble my PHP tags so I rewrote it in a way I could still get the idea across. Thanks for posting the better way though :slight_smile:

Ha, yeah, I remember it used to garble code whenever you added PHP tags but it seems as though they’ve fixed it… I don’t know when though :bigsmile:


#8
theninja said

Ha, yeah, I remember it used to garble code whenever you added PHP tags but it seems as though they’ve fixed it… I don’t know when though :bigsmile:

Good to know! :slight_smile:


#9

Arggh sorry Ninja, I didnt see your reply. GMTA huh.

Cheers Dude :slight_smile: