Shopping Cart Forum

Go Back   eShop Forums - eCommerce Help Forum for Shopping Cart Owners. > Tech Corner > PHP/HTML/CSS/JavaScript and Servers
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
PHP/HTML/CSS/JavaScript and Servers Pick up tips and exchange info on the technical side of having a web presence.

Freestart, click here
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 14-10-2007, 05:49 AM
Lawrence Lawrence is offline
Forum Admin
 
Join Date: Aug 2007
Location: Kenley, Surrey, UK
Posts: 1,226
Thanks: 2
Thanked 82 Times in 82 Posts
Default How to create an auto updating copyright date using PHP.

This is a very simple script to automatically update your copyright notification every Jan 1st. It uses PHP's versatile date() function to extract the year from the current date then print it to the user's browser.

This example is very simplified. In a real world situation you would probably include some HTML in the echo statement to format the output to the browser.
PHP Code:
<?php
$year 
date("Y");
echo 
"Copyright &copy; $year";
?>
The is another way to achieve the same result. Depending on how the rest of the page is structured, this may be a more appropriate method.
PHP Code:
<p>Copyright &copy; <?php echo date("Y"); ?></p>
The advantage of the second method is that if you are using a WYSIWYG editor e.g. Dreamweaver to edit the page, you have something to work with in design view. With the first method nothing will show in design view, everything will have to be coded by hand.
__________________
Lawrence
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
php


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create ringtone website? nicky9 PHP/HTML/CSS/JavaScript and Servers 0 03-06-2008 09:50 AM
How to create forums application in c# MeenaM PHP/HTML/CSS/JavaScript and Servers 3 12-05-2008 01:28 PM
Product Date Ranges Eveslegwear Zen Cart & osCommerce 5 22-12-2007 11:38 AM
Brand Keywords Create Your Long-term Sustainable Profit Margin SEOBook SEO and PPC 0 29-09-2007 08:25 PM
How to change the date format in Zen from US to UK. Lawrence Zen Cart & osCommerce 0 15-08-2007 01:22 AM

Google

Edible Graphics, Affordable E-Commerce, Web Shops & Custom Form Scripts
Fair Trade Quality Handmade Photo Albums & Gifts
tech news, product reviews, the latest home and business technology, the latest in digital imaging


Content Relevant URLs by vBSEO 3.0.0