PDA

View Full Version : JS; Auto increment copyright date > PHP


ArcticFox
03-28-2005, 02:26 AM
http://www.javascriptkit.com/script/script2/updatedcredit.shtml

Is there a way to edit this script into PHP that would change the copyright printed on the page as well as change the copyright statement inside source info?


:confused:

Coastal Web
03-28-2005, 05:05 AM
you mean something like this?

<?php

$start_date = "1997"; //<-edit with year site started
$current_year = date(Y);

echo <<<end

Copyright &copy; $start_date-$current_year
<a href="http://www.sample.com">Sample.com</a>

end;

?>

ArcticFox
03-28-2005, 06:08 AM
Nice! Thank you. :) That covers the first idea, yet is there also a way to also print it into a commented-out section in the source?


<html ondrag="return false" onselectstart="return false" onselect="return false">
<head><title>Abigail Dreams</title>

<!--
/######### Disclaimer ############################\
## ##
## “Abigail Dreams” ##
## ##
## Copyright © 1996-2004 ~ Arctic Fox ##
## Permission to reproduce, reuse, or modify ##
## these scripts is denied - unless a link to ##
## this site is provided. ##
## ##
## Other copyrights & trademarks belong to ##
## their respective owners. ##
## Thanks for visiting! :) ##
## ##
\#################################################/
-->

<meta http-equiv="Imagetoolbar" content="no">
<meta http-equiv="Content-language" content="en">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


I just figured out one way to do it; have another PHP code for ECHOing the entire commented section... but, there's got to be another, less stressful way to do it???

Coastal Web
03-28-2005, 06:15 AM
EDIT:
Oops, sorry didn't see the rest of your message after your code...
I'm sure there is another way to do it, but l honestly can't think of it...
If l was in your shoes, l'd probably save 2 .php files..
one for the commented out portion of your copyright, and one for the part that actually displays on the screen..

and then use:

<?PHP include("path/to/commented_out_copyright.php"); ?>

and

<?PHP include("path/to/html_copyright.php"); ?>

that way you could quickly include your "updatedable" copyright script on every page you create....

Samantha Gram.


*****************************
Of course.....

commented_out_copyright.php would be:

<?php

$start_date = "1997"; //<-edit with year site started
$current_year = date(Y);

echo <<<end

<!--
/######### Disclaimer ############################\
## ##
## “Abigail Dreams” ##
## ##
## Copyright &copy; $start_date-$current_date ~ Arctic Fox ##
## Permission to reproduce, reuse, or modify ##
## these scripts is denied - unless a link to ##
## this site is provided. ##
## ##
## Other copyrights & trademarks belong to ##
## their respective owners. ##
## Thanks for visiting! :) ##
## ##
\#################################################/
-->
end;

?>

and html_copyright.php would be:


<?php

$start_date = "1997"; //<-edit with year site started
$current_year = date(Y);

echo <<<end
Copyright &copy; $start_date-$current_year
<a href="http://www.sample.com">Sample.com</a>

end;

?>

ArcticFox
03-28-2005, 06:32 AM
Thanks a bunch for your help!

I was able to play with it a bit and did come up with this:


<head>

<?php

$start_date = "1996"; //<-edit with year site started
$current_year = date(Y);

echo <<<end
<!--
/######### Disclaimer ############################\
## ##
## “Abigail Dreams” ##
## ##
## Copyright © $start_date-$current_year ~ Arctic Fox ##
## Permission to reproduce, reuse, or modify ##
## these scripts is denied - unless a link to ##
## this site is provided. ##
## ##
## Other copyrights & trademarks belong to ##
## their respective owners. ##
## Thanks for visiting! :) ##
## ##
\#################################################/
-->
end;
?>


</head>
<body>


<?php
echo <<<end
Copyright © $start_date-$current_year ~ Arctic Fox
end;
?>


...which seems to work.

I'll definately be using that PHP include thing later - I didn't know it was possible to do that. :eek:

Thank you. :thumbsup: