467,893 Members | 1,898 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,893 developers. It's quick & easy.

include content of navbar in css?

Hello

In the w3c website:
http://www.w3.org/Style/Examples/011/firstcss

There is an example of a first attempt of a css. Is it possible that
Not only the form but also the content of navbar is included in the
css?

That would be useful for web pages which should all contain the same
navbar.
Thanks

Uwe Brauer
Jul 20 '05 #1
  • viewed: 4382
Share:
23 Replies
On Wed, 30 Jun 2004 17:31:24 +0200, Uwe Brauer <ou*@mat.ucm.es> wrote:
Hello

In the w3c website:
http://www.w3.org/Style/Examples/011/firstcss

There is an example of a first attempt of a css. Is it possible that
Not only the form but also the content of navbar is included in the
css?

That would be useful for web pages which should all contain the same
navbar.


CSS does not allow for the inclusion of content beyond some trivial
extra text here and there. You certainly can't, at least without major
pains, create an entire navigation bar structure in CSS alone.

This kind of thing *can* be done by applying an XSLT stylesheet to a
basic HTML document which generates a more complex HTML document, but
browser support for this is spotty and you will be required to serve
your HTML documents as XML, which will prevent users of old browsers
from dealing with them at all.

One approach is to look for the XHTML content-type in the Accept
header and, if it's absent, do the XSLT preprocessing on the server
rather than the client. However, once you start preprocessing on the
server it's easier just to preprocess on the server for everyone.

Take care,
-Claire
Jul 20 '05 #2
On 30 Jun 2004, fa**@invalid.com wrote:
On Wed, 30 Jun 2004 17:31:24 +0200, Uwe Brauer <ou*@mat.ucm.es>
wrote:

CSS does not allow for the inclusion of content beyond some trivial
extra text here and there. You certainly can't, at least without
major pains, create an entire navigation bar structure in CSS alone.

This kind of thing *can* be done by applying an XSLT stylesheet to a
basic HTML document which generates a more complex HTML document,
but browser support for this is spotty and you will be required to
serve your HTML documents as XML, which will prevent users of old
browsers from dealing with them at all.

One approach is to look for the XHTML content-type in the Accept
header and, if it's absent, do the XSLT preprocessing on the server
rather than the client. However, once you start preprocessing on the
server it's easier just to preprocess on the server for everyone.

Take care, -Claire


Thanks very much for this respond, so it seems to me there is no
simple solution to my problem. Our webpage (in the department)
contains at the moment frames, with all the inconveniences frames
causes. That's why I thought of using css. Since I want to keep the
page simple and keeping in mind
http://www.anybrowser.org/campaign/
I am not very much tempted to use XSLT, but this is also caused by my
lack of knowledge.

Meanwhile doing a google search, I found that someone posted a
solution using javascript, but it does not seem to work neither.
Regards

Uwe
Jul 20 '05 #3
On Wed, 30 Jun 2004 18:07:45 +0200, Uwe Brauer <ou*@mat.ucm.es> wrote:

Thanks very much for this respond, so it seems to me there is no
simple solution to my problem. Our webpage (in the department)
contains at the moment frames, with all the inconveniences frames
causes. That's why I thought of using css. Since I want to keep the
page simple and keeping in mind
http://www.anybrowser.org/campaign/
I am not very much tempted to use XSLT, but this is also caused by my
lack of knowledge.

Meanwhile doing a google search, I found that someone posted a
solution using javascript, but it does not seem to work neither.


PHP. You can include a snippet of code into the HTML before the server
serves the page to the UA, and you can even manipulate exactly how that
snippet is chosen or assembled based on other parameters.

http://www.php.net
Jul 20 '05 #4
On Wed, 30 Jun 2004 17:31:24 +0200, Uwe Brauer <ou*@mat.ucm.es> wrote
or quoted :
That would be useful for web pages which should all contain the same
navbar.


I handle much of this with static macros. Just before uploading, I
expand the macros, and then compact out any unnecessary white space,
and "untouch" to redate files that have not really changed.

The macros are written in Java. The advantage of this is I don't need
any server side code and it requires no extra time to serve. I also
can provide a local mirror of my site with the macros pre-expanded
that automatically stays up to date.

I talk a bit more about it at http://mindprod.com/jgloss/html.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 20 '05 #5
On 30 Jun 2004, ne*****@yahoo.com wrote:
On Wed, 30 Jun 2004 18:07:45 +0200, Uwe Brauer <ou*@mat.ucm.es>
wrote:
PHP. You can include a snippet of code into the HTML before the
server serves the page to the UA, and you can even manipulate
exactly how that snippet is chosen or assembled based on other
parameters.

http://www.php.net

Are we talking about the same, that is using javascript?
Could you please give me an example, the one I have goes as
mymenu.js

document.write("<span class='menus'>
<a href='index.html'>Esta pagina</a>|
<a href='personal.html'>Personal</a>|
<a href='info.html'>Información general</a>
</span>")

And then having

<script src="mymenu.js"></script>
in the main file.

Jul 20 '05 #6
On 30 Jun 2004, lo*****@mindprod.com.invalid wrote:

That would be useful for web pages which should all contain the
same navbar.

I talk a bit more about it at http://mindprod.com/jgloss/html.html

ok thanks I have a look, your macro also allows you to change easily
the content of a navbar I presume?

(I was thinking of using Xemacs for this purpose if not html solution
can't be find. It allows me replacments of varios files).
Jul 20 '05 #7
Uwe Brauer wrote in
<86************@mat.ucm.es>
Hello

In the w3c website:
http://www.w3.org/Style/Examples/011/firstcss

There is an example of a first attempt of a css. Is it possible that
Not only the form but also the content of navbar is included in the
css?

That would be useful for web pages which should all contain the same
navbar.


SSI is a simple solution, though it's not CSS
You'd use something like:
<!--#include file="navbar.txt" -->
Where navbar.txt is a text file that is inserted into your html file at that
point and includes the content and mark-up of the navbar.

Info at:
http://bignosebird.com/sdocs/include.shtml

Dead easy.

--
PeterMcC
If you feel that any of the above is incorrect,
inappropriate or offensive in any way,
please ignore it and accept my apologies.

Jul 20 '05 #8
On 30 Jun 2004, pe***@mccourt.org.uk wrote:
Uwe Brauer wrote in <86************@mat.ucm.es>
Hello

In the w3c website: http://www.w3.org/Style/Examples/011/firstcss

There is an example of a first attempt of a css. Is it possible
that Not only the form but also the content of navbar is included
in the css?

That would be useful for web pages which should all contain the
same navbar.


SSI is a simple solution, though it's not CSS You'd use something
like: <!--#include file="navbar.txt" --> Where navbar.txt is a text
file that is inserted into your html file at that point and includes
the content and mark-up of the navbar.

Info at: http://bignosebird.com/sdocs/include.shtml

Dead easy.

Well thanks, however it does not work for mozilla 1.6 on linux, I
followed the instructions of the web page and no go. I tried it
locally in the directory and even put in on my apache server, no way
the mailform1.txt file is:

<ul class="navbar">
<li><a href="index.html">Esta pagina</a>
<li><a href="personal.html">Personal</a>
<li><a href="info.html">Información general</a>
</ul>

It this a bug of mozilla?
Jul 20 '05 #9
Uwe Brauer wrote:
On 30 Jun 2004, pe***@mccourt.org.uk wrote:
SSI is a simple solution
Well thanks, however it does not work for mozilla 1.6 on
linux,


The browser has nothing to do with it. SSI is done on the server,
before the client ever sees it.
I followed the instructions of the web page and no go. I
tried it locally in the directory
That will fail; you need a server to do the include.
and even put in on my apache server, no way


The Apache server needs to be configured to allow it. Ask them about
it. Talk to you isp about this.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #10
ne*****@yahoo.com wrote:
PHP. You can include a snippet of code into the HTML before the
server serves the page to the UA, and you can even manipulate
exactly how that snippet is chosen or assembled based on other
parameters.

http://www.php.net

Uwe Brauer <ou*@mat.ucm.es> wrote: Are we talking about the same, that is using javascript?


No, not at all. PHP is a server-side mechanism. Like other server-side
mechanisms, the only variables are on the server side: Is it supported? Is
it properly configured? Etc. If it works for anyone, then it works for
everyone.

JavaScript is a client side, so you can't even rely on it being supported.
Even when it is supported, it may not be enabled. Even when it is enabled,
you have no idea what version of JavaScript, or what DOM, the browser
supports.

For common site-wide content like navigation links, use something reliable.
Not JavaScript.

See also http://www.htmlhelp.com/faq/html/des...l#include-file
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"I've cut this board three times, and it's still too short!"
Jul 20 '05 #11
On Wed, 30 Jun 2004 19:07:12 +0200, Uwe Brauer <ou*@mat.ucm.es> wrote
or quoted :
ok thanks I have a look, your macro also allows you to change easily
the content of a navbar I presume?


I write the custom macros in Java, so they can do anything I want.

I have added some links to examples at
http://mindprod.com/jgloss/html.html
- book recommendations with links to a variety of bookstores
- menus with the current page highlighted
- displays that change prices to the local currency
- Quilt menus automatically sorted by column
- references to multiple sources for Sun documentation
- Colourful CSS-ized source code listings
- Headers, footers
- nested boiler plate includes
- List of products, prices, downloads, documentation
- automatic index generation
- automatically generated directory of Health practitioners
from an Abundance database.


The advantages of my unusual approach are:
I don't need any server side code or Servlet womb. I can run my
website on a completely vanilla, stable, easily mirrorable, HTTP
server.

My code is much simpler and easier to debug than JSP or Servlets. It
is just a vanilla Java application.

I can provide a local mirror copy of the website to my readers that
stays up to date, but requires no local webserver.

The pages download faster since they are fully prepared in advance,
including compacting out unnecessary white space.

I don't need to rely on buggy, browser dependent JavaScript.

I have the full flexibility and speed of Jet-natively-compiled Java
code to create my content, with no RAM or response time worries.

Google likes my site, ranking it highly and spidering it often,
possibly because the page date does not change unless the page really
has changed. That feature and the compaction saves them time
spidering.

The disadvantages of my approach are:

My pages don't interact with the user, other than via Applets. There
are no FORMS. FORMS have to be handled separately.

Since I usually avoid JavaScript, my pages lack pizzazz. I done that
deliberately to create a slightly old-fashioned, more personal look. I
wanted to avoid anything that shouted "sales". That is not what my
site is about.

Global changes not handled by CSS trigger massive uploads.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 20 '05 #12
On 30 Jun 2004, mc****@stanfordalumni.org wrote:
No, not at all. PHP is a server-side mechanism. Like other
server-side mechanisms, the only variables are on the server side:
Is it supported? Is it properly configured? Etc. If it works for
anyone, then it works for everyone.
Ok, I see

For common site-wide content like navigation links, use something
reliable. Not JavaScript.
I agree, coincides with my experience, my web site of my university
relies heavily on javascript (the MS version which does not work
properly for mozilla.)
See also http://www.htmlhelp.com/faq/html/des...l#include-file


Thanks for the link
Jul 20 '05 #13
On 30 Jun 2004, us*****@julietremblay.com.invalid wrote:

The Apache server needs to be configured to allow it. Ask them about
it. Talk to you isp about this.


Ok, I was not aware of this, I tried out on my local linux machine,
but anyhow it will go to an official place. Thanks for pointing this
out to me.

Jul 20 '05 #14
On 30 Jun 2004, us*****@julietremblay.com.invalid wrote:

That will fail; you need a server to do the include.

Forgot to mention, the downside of this approach is of course, that
you can not test this particular part of the web page before putting
it on the server, but nothing in live is perfect.
Jul 20 '05 #15
Uwe Brauer <ou*@mat.ucm.es> wrote in
news:86************@mat.ucm.es:
On 30 Jun 2004, us*****@julietremblay.com.invalid wrote:

That will fail; you need a server to do the include.

Forgot to mention, the downside of this approach is of
course, that you can not test this particular part of the web
page before putting it on the server, but nothing in live is
perfect.


If you've got a local linux machine, it should come with Apache.
All you need to do is configure it to work with server side
includes.

Apache Tutorial: Introduction to Server Side Includes
http://httpd.apache.org/docs/howto/ssi.html

http://www.google.com/search?q=ssi+apache+configure

--
Kayode Okeyode
http://www.kayodeok.co.uk/weblog/
http://www.kayodeok.btinternet.co.uk.../webdesign.htm
Jul 20 '05 #16
Thanks very much, looks very interesting.

Uwe
Jul 20 '05 #17
On Wed, 30 Jun 2004 20:07:59 +0200, Uwe Brauer <ou*@mat.ucm.es> wrote
or quoted :
Well thanks, however it does not work for mozilla 1.6 on linux, I
followed the instructions of the web page and no go. I tried it
locally in the directory and even put in on my apache server, no way
the mailform1.txt file is:


SSI has nothing to do with the browser. You either generated the
correct nav bar code or you did not. You can check with view source in
any browser.

SSI is notoriously non-standard. See
http://mindprod.com/jgloss/ssi.html
The big problem with relying on SSI is if you have a backup mirror
site, chances are it won't have SSI or will support it a different
way.

One alternative is to write your own simple static SSI that will then
work to matter who hosts it.

For example on my site, instead of an SSI include I use

<!-- macro Include filename -->

Which is expanded just prior to uploading.

One way around the non-standard SSI problem is to generate two
flavours of SSI, one for each site, with static macros.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 20 '05 #18
On Wed, 30 Jun 2004 21:20:47 +0200, Uwe Brauer wrote:
That will fail; you need a server to do the include.
... Forgot to mention, the downside of this approach is of course, that
you can not test this particular part of the web page before putting
it on the server,


Sure you can, there are a number of servers
you can install on a PC for free (I am running
Apache to test my stuff locally before it gets
posted to the live site). Do not see the lack
of a local testing server as a show-stopper.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 20 '05 #19
Uwe Brauer wrote:
Since I want to keep the page simple and keeping in mind
http://www.anybrowser.org/campaign/
I am not very much tempted to use XSLT, but this is also caused by my
lack of knowledge.


XSLT is purely server-side and does not require any browser support. The
browser gets fed plain HTML with the nav pre-inserted, as if you'd
written it into every page.

I'd go with PHP if you have sufficient influence over the server. If
you've ever programmed in C or a similar language, you'll have no
trouble picking it up.

My site uses PHP to merge together a document header, footer and by-area
menu file with content pulled from a MySQL database. It does
search-and-replaces to fix IE shortcomings and serves the content as
either HTML or XHTML as requested by the browser. But all of this
behind-the scenes magic only relies on the browser supporting HTML.

Another option is to use server-side includes (SSIs).

Good luck!

--
Mark.
Jul 20 '05 #20
"Roedy Green" <lo*****@mindprod.com.invalid> a écrit dans le message de
news:76********************************@4ax.com
The big problem with relying on SSI is if you have a backup mirror
site, chances are it won't have SSI or will support it a different
way.


I'm really surprised with what you wrote ! Within all the server side
inclusion technologies, the SSI include directive is surely the most widely
supported ! Some servers doesn't allow the include ssi directive, but if so
they don't allow anything server side.

Jul 20 '05 #21
Uwe Brauer wrote:
Forgot to mention, the downside of this approach is of course, that
you can not test this particular part of the web page before putting
it on the server, but nothing in live is perfect.


Put a server on your machine. Then you can test pages in an
environment very close to the live site.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #22
On Thu, 01 Jul 2004 11:17:04 -0400, Brian
<us*****@julietremblay.com.invalid> wrote or quoted :
Put a server on your machine. Then you can test pages in an
environment very close to the live site.

Not only A server, the SAME server your ISP uses. That may not be
practical if your ISP uses Novell for example.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Jul 20 '05 #23
Roedy Green wrote:
Brian wrote or quoted :
Put a server on your machine. Then you can test pages in an
environment very close to the live site.


Not only A server, the SAME server your ISP uses.


Sure, that too. I'm sort of surprised to find anything but Apache on
web servers, though such a thing does exist.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #24

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mike Kozlowski | last post: by
3 posts views Thread by David | last post: by
11 posts views Thread by A.Translator | last post: by
23 posts views Thread by Big Bill | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.