Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 8th, 2010, 07:28 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Unhappy Header/Footer in web-page.

Hi,

I know this is very common question but just wanted to get the upto-date knowledge on :

"How can I put custom page header and footer (only visible while printing) in my web page?"

as by default it prints URL and page count.

Thank you .
 
Old November 8th, 2010, 03:25 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You can't. Unfortunately, the header and footer are created BY THE BROWSER.

And so you would have to give instructions to your users how to change the browser (and each browser is different). Worse, you would have to give them instructions on how to change the settings *BACK* to the original, so that other pages that are printed don't end up with your header and footer.
The Following User Says Thank You to Old Pedant For This Useful Post:
rupen (November 16th, 2010)
 
Old November 15th, 2010, 03:56 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

It sounds like you're talking about printer headers and footers in which case Old Pedant is exactly correct. Unfortunately, everything you've heard about web standards has yet to get anywhere near the printer media type. Browsers are starting to agree on display on screen, but even the most modern "ACID2" browsers have appalling CSS support for printer styling. We're still in the 1990s as far as that goes.

If you are refering to header and footers on a webpage, the story is different. Using only HTML there is a simple, but slow technique called server side includes (SSI). You simply write a header, footer, and / or other components in HTML into a file. Then, you add an SSI reference to the main webpage and the HTML snippet in the file gets pasted into that point in the webpage. This is done by the server each time the page is requested which is why SSI does not perform particularly well especially as your website scales up.

Really you want to adopt a templating system. .NET is perfect for this as it gives you a much faster technique for performing the exact same technique as server side includes, user controls. Moreover, these can be used with master pages which are sort of the opposite. You can now write the custom snippets which appear as content of a webpage and identify the master page which those pieces fit into (as if the webpage you're writing is the included file, virtually backwards). These two .NET techniques allow you to meet virtually any templating needs (either to pull a snippet into your webpage [a user control] or to push the webpage into a larger template [a master page]). The results are also cached so that the server does not have to process the code everytime, but only the first.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
The Following 2 Users Say Thank You to chroniclemaster1 For This Useful Post:
rupen (November 16th, 2010)
 
Old November 15th, 2010, 04:58 AM
Registered User
 
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rupen
Default

Thank you guys for your reply, I though the same that right now we can't specify header/footer while printing.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking Header and/or Footer x_ray Word VBA 1 January 2nd, 2007 01:02 AM
header footer zaman1111 JSP Basics 0 July 28th, 2005 05:00 PM
is it psossible to customize header footer page or Swapnil VB How-To 0 February 1st, 2005 03:07 AM
Print web page withiout printing url footer rekha_jsr Classic ASP Basics 4 September 15th, 2004 10:47 PM
can footer value show in header? yancyn Crystal Reports 0 August 5th, 2004 01:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.