473,836 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help putting standard headers on all pages

I've been looking for references for some weeks now, but haven't found
an answer to the following question. I'd love some help on this:

*Without* using JavaScript or other active client-side scripting,
server-side includes or frames, is there a way to include a standard
header on all pages within a site? The design goal is to have the
header links and title graphic on every page kept in some single
place, so that a change to the header data doesn't require changing
every single html file on the site. (The sites in question are my
personal sites - see signature).

In other words, I want a way to do this in regular (non-framed) non-
active HTML and CSS only. It seems like there ought to be a way to do
it with CSS, but I really can't work it out.

Thanks for any pointers...

--
Lewin A.R.W. Edwards
Projects - http://www.zws.com/
Personal - http://www.larwe.com/

Sep 21 '08
68 4755
zw*******@gmail .com wrote:
I've been looking for references for some weeks now, but haven't
found an answer to the following question. I'd love some help on
this:

*Without* using JavaScript or other active client-side scripting,
server-side includes or frames, is there a way to include a standard
header on all pages within a site?
You will need some form of server side process to do this. If you don't
want to use SSI, you could use a scripting language, such as Perl or
PHP, etc., to assemble each page before it is delivered. Perl has a very
simple yet robust templating module just for this purpose. I would not
be surprised if PHP did as well. I don't know if the load on the server
would be any less than with SSI.

http://search.cpan.org/~samtregar/HT....9/Template.pm
Sep 21 '08 #11

zw*******@gmail .com wrote:
>I've been looking for references for some weeks now, but haven't found
an answer to the following question. I'd love some help on this:

*Without* using JavaScript or other active client-side scripting,
server-side includes or frames, is there a way to include a standard
header on all pages within a site? The design goal is to have the
header links and title graphic on every page kept in some single
place, so that a change to the header data doesn't require changing
every single html file on the site. (The sites in question are my
personal sites - see signature).

In other words, I want a way to do this in regular (non-framed) non-
active HTML and CSS only. It seems like there ought to be a way to do
it with CSS, but I really can't work it out.
Get a text editor that can search and replace large blocks
of text in multiple files. It takes me about 15 seconds
more to I can change the header in a thousand webpages
instead of just one.

BTW, what do you have against server-side includes?
--
Guy Macon
<http://www.GuyMacon.co m/>

Sep 21 '08 #12

Content-Transfer-Encoding: 8Bit
zw*******@gmail .com wrote:
>
Ben Bacarisse wrote:
>The usual method it to include some sort of build step when making the
site. *There are literally dozens of options from WYSIWYG site editing
software to using a macro processor and something like make.

Hmm... I didn't include that in the list because it's not the design
goal - I don't want to have to re-upload every single HTML file. I
don't know if it's my hosting provider (Verve) or something else, but
I frequently get dropped/stalled connections.
So? A good FTP client will keep plugging away at it until
all the files have been replaced.
>I'm kinda surprised that this is really the "usual" method though. It
seems like a really common requirement, it astounds me that there is
no elegant solution.
There is an elegant solution. SSI. You rejected it because of
performance issues, but it is still an elegant solution.

Is there any chance that your server admins are afraid of huge
resource-hogging build-it-on-the-fly SSI but would have no real
problem with a simple common-header SSI? Those really don't
use that many resources, and actually *reduce* some kinds of
resource use (less disk bandwidth, for example).
>I don't "do" the traditional text processing languages like
perl, but I guess it would be a simple matter to write a C program
that recursively descends the tree, looks for some magic tokens like
<!--##headerbegin##--<!##--headerend##--and replaces whatever's in
between with my generic site header.
Easy enough in C or pretty much any other language except BEST.
--
Guy Macon
<http://www.GuyMacon.co m/>

Sep 21 '08 #13

zw*******@gmail .com wrote:
>I don't want to use SSIs because they severely impact performance on
my provider.
And they let you use CSS? I wouldn't be surprised if processing
your CSS results in more use of server resources than a simple
header-replace SSI would.
--
Guy Macon
<http://www.GuyMacon.co m/>

Sep 21 '08 #14
zw*******@gmail .com wrote:
I've been looking for references for some weeks now, but haven't found
an answer to the following question.
In the good old times, people would just have looked at a FAQ and got the
correct answer in a few seconds. But time has passed by, the FAQs are
covered with dust, and their defenders have gone away...
*Without* using JavaScript or other active client-side scripting,
server-side includes or frames, is there a way to include a standard
header on all pages within a site?
You exclude here everything except preprocessing.
In other words, I want a way to do this in regular (non-framed) non-
active HTML and CSS only.
This seems to exclude preprocessing too, since it's definitely not HTML (and
CSS has nothing to do with the issue really). So you are asking "how to do
include without using any of the mechanisms for it?"

Well, to be honest, although the dusty old FAQs said - and the HTML
specifications implicitly say - that there is no include mechanism in HTML,
beyond the fake inclusion via frames, iframe, or object, there _is_. The
only problem is that no browser implements it.

Since the very beginning of HTML as "officially " defined, it has had an
inclusion mechanism by virtue of being an SGML application, later an XML
application. For fun, here is how you could do it "modern HTML", i.e. XHTML:

?xml version="1.0" standalone="no" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
[
<!ENTITY headers SYSTEM
"http://www.cs.tut.fi/~jkorpela/test/headers.xhtml">
]>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Inclusio n demo</title>
</head>

<body>
&headers;
<h1>Inclusion demo</h1>
<p>Hello world!</p>
</body>

</html>

(And you could do quite the same thing in pre-XHTML HTML as well.)

But you will see that web browsers won't grok it. They will fail in
different ways. What comes closest perhaps is, somewhat surprising, Internet
Explorer in the situation where you serve this document as plain XML,
application/xml. It will render the document as XML source but after
properly processing the inclusion; and you could always use a style sheet to
have it rendered in some real way.

To be very honest, modern HTML specifications require a specific DOCTYPE
declaration to be used, so they exclude this feature. But you could always
use HTML 2.0, which has no such restriction! :-) And then you could ask some
students to write a browser that supports HTML 2.0 - the first one in the
world that does that! - and try and find a make the world use that browser
or other HTML 2.0 conformant browsers.

So it's time to wake up and state that there ain't no include in HTML as
implemented in the so-called real world. You need to use _some_ mechanism
external to HTML.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Sep 21 '08 #15
On Sep 21, 2:09*am, Guy Macon <http://www.GuyMacon.co m/wrote:
I don't want to use SSIs because they severely impact performance on
my provider.

And they let you use CSS? * I wouldn't be surprised if processing
your CSS results in more use of server resources than a simple
header-replace SSI would.
What does CSS do on the server side? My understanding is that they're
rendered entirely at the client end. The HTML file references the
stylesheet, and the browser loads it. No server-side processing.
Sep 21 '08 #16
zw*******@gmail .com wrote:
Having said all this, talking about frames again has made me think a
bit more and leads me to believe that the "right" answer is possibly
an IFRAME as it appears to be more bot-friendly than a normal
frameset.
If you have started thinking that IFRAME is the solution, it's time to
re-think the problem.

No amount of reduction in site management work (like moving from manually
maintained headers to iframed header file) could ever justify all the
problems you create by using IFRAME.

How often do you intend to change the common header? Monthly? Weekly? Well,
in that case, you should design the site in a new way that does not require
such frequencies of changes there. Design something that lasts a couple of
years. (And when it will need modifications, you will probably want, or be
forced to do, a complete redesign anyway.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Sep 21 '08 #17
On Sep 21, 7:27*am, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
bit more and leads me to believe that the "right" answer is possibly
an IFRAME as it appears to be more bot-friendly than a normal

If you have started thinking that IFRAME is the solution, it's time to
re-think the problem.
I did some googling on problems with IFRAMEs, and I can't see any show-
stoppers, care to explain why it is a problem? As near as I can work
out it is exactly the kind of client-side #include feature I want;
though not 100% bot-friendly I can work around this by having a (not-
intended-for-users-to-click) link to the IFRAME src page at the bottom
of the body content.
How often do you intend to change the common header? *Monthly? Weekly? Well,
The idea is to put a "new this week" type of link there, for example a
thumbnail picture of progress on one of my projects.
Sep 21 '08 #18
On Sun, 21 Sep 2008, Jukka K. Korpela wrote:
How often do you intend to change the common header? Monthly? Weekly? Well,
in that case, you should design the site in a new way that does not require
such frequencies of changes there. Design something that lasts a couple of
years. (And when it will need modifications, you will probably want, or be
forced to do, a complete redesign anyway.)
I cannot speak for the OP, but a navigation bar linking to other articles
could be something that changes monthly, is wanted to appear with the
lastest contents on each page, and shall be updated at only one place.
Nowadays, this is done with a CMS but when one has not so many pages (say,
about 30) the labour of configuring a CMS and updating its software might
exceed the labour saved by it. -- This is not a new requirement and SSI
is exactly tailored to such needs: simple enough to be used without
learning, and still doing something useful if not more is needed.

Excluding SSI and all other solutions that might help renders the question
somewhat academic.

BTW, I am not sure CSS cannot be tricked to do the job somehow. But even
if possible, that would be an extremely bad solution: Web pages must not
depend on CSS, only their appearance may.

--
Helmut Richter
Sep 21 '08 #19
zw*******@gmail .com writes:
On Sep 20, 9:45¬*pm, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
>The usual method it to include some sort of build step when making the
site. ¬*There are literally dozens of options from WYSIWYG site editing
software to using a macro processor and something like make.

Hmm... I didn't include that in the list because it's not the design
goal - I don't want to have to re-upload every single HTML file.
That does not follow unless you change the common parts. A good build
systems just uploads the parts that change.
I
don't know if it's my hosting provider (Verve) or something else, but
I frequently get dropped/stalled connections.
You also say that SSI imposes a large cost on your hosting provider.
If the upload problems are also their fault, you should change
provider (for me, just one of these would be enough).
I'm kinda surprised that this is really the "usual" method though. It
seems like a really common requirement, it astounds me that there is
no elegant solution.
What is inelegant about a good build system?
At the moment I'm using the free version of Visual Web Developer
(inside VirtualBox on my MacBook - it's the best free WYSIWYG CSS-
supporting HTML editor I can find). I'm not sure if it supports this
feature. I don't "do" the traditional text processing languages like
perl, but I guess it would be a simple matter to write a C program
that recursively descends the tree, looks for some magic tokens like
<!--##headerbegin##--<!##--headerend##--and replaces whatever's in
between with my generic site header.
Your perfect time to learn Perl (or at least one use of it)! Perl has
a template tool that can do exactly this (and, of course, much more),
ttree, which processes a tree of template files.
I was hoping to be able to have a
"news of the week" or "news of the day" item in this header, i.e.
relatively frequent updates without rewriting everything.
I don't see why "everything " needs to be re-written. A build system
will change just those files that need to be changed and no others. A
good remote update program will upload only those files that have
changed. For small sites this is a good solution. An update involves
typing:

ttree -s source
sitecopy --update name

(or in a couple of cases "make" rather than "ttree").

--
Ben.
Sep 21 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
1535
by: xxx | last post by:
I'm having a little trouble understanding why a derivative class cannot access a protected member of the base class in the following code: #include <stdio.h> class CBase { protected: int x;
8
5484
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
37
2513
by: John Salerno | last post by:
I contacted my domain host about how Python is implemented on their server, and got this response: ------------------- Hello John, Please be informed that the implementation of python in our server is through mod_python integration with the apache. These are the steps needed for you to be able to run .py script directly
41
2722
by: c | last post by:
Hi every one, Me and my Cousin were talking about C and C#, I love C and he loves C#..and were talking C is ...blah blah...C# is Blah Blah ...etc and then we decided to write a program that will calculate the factorial of 10, 10 millions time and print the reusult in a file with the name log.txt.. I wrote something like this
4
6349
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59 Notice: Undefined index: args in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92 Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_error.php on line 92
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10255
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6980
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.