Code snippits I always use in the footer

My email program of choice is gmail because it’s so easy to use and they are constantly improving their product. What the main reason is I use it is for is the filtering and search. I have a filter I set up called “code snippits” and any time I want to save a bit of code even if really small I can just go to that filter and search with in that filter for something I saved. Whats more is that I can access gmail from anywhere so my code snippit library is always with me. Adobe Dreamweaver has the ability to save snippits of code which is where I got the name in the first place but I then have to rely on it being on my laptop or desktop machine. With an internet based solution I am not chained to one machine for the snippit of code I saved.

I thought I would check in my snippit library and share a couple that I always use on a basic web template that I set up. This is especially important for large sites and that’s a “back one page link”. A person can always hit the browser back button but if they are actually reading your text then including a back link to the previous page they were on is helpful and ads a touch of professionalism. I tend to include this in my footer file for a template. The idea of a footer in a templage is that it is going to show up on every page. So before the copyright and contact information and extra links I include this little line of java script at puts a small back link on every page.

(<a href=”javascript:history.back();” >go back one page</a>)

Which looks and works like this: (go back one page)

The second item I always include is the copyright along with the current year. Of course your work is copyrighted from the moment you create it and there are arguments about weather you should or shouldn’t use it but all the major companies do so I will just follow the norms of the ones with the really big lawyers! This makes it tough though to keep your site up to date when you want to change the year on every page every year. Surprising how fast a year rolls around! Then all of a sudden people see an old year on your site and regardless of the legal reasons it just looks like your site is out of date.

So problem solved is just to do it once with this little bit of java scrip that inserts the year after your little copyright symbol and then the name of your business or company. Then you never have to think about it again! Build it into your template and it’s on every page hence forth on your site!

This: <strong>&copy; <script type=”text/javascript”> year = new Date();   document.write(year.getFullYear());               </script> Your Company name</strong>

Makes this: ©You’re Company Name

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.