modular code

C

cbnewman

Is there any way to use CSS to implement modular code? In other words,
if I have a footer that I want to be displayed on every page but I
only want to update it in one place (perhaps a single HTML file) how
can I get it to display on every page on my site? I know I could
implement this solution with frames, but I would rather not...
 
E

Ed Seedhouse

Is there any way to use CSS to implement modular code?
No.

In other words,
if I have a footer that I want to be displayed on every page but I
only want to update it in one place (perhaps a single HTML file) how
can I get it to display on every page on my site?

Not with CSS.

I know I could
implement this solution with frames, but I would rather not...

And you shouldn't. Use server side includes, PHP, ASP, JSP or some
other serve side technology.
 
D

dorayme

Is there any way to use CSS to implement modular code? In other words,
if I have a footer that I want to be displayed on every page but I
only want to update it in one place (perhaps a single HTML file) how
can I get it to display on every page on my site? I know I could
implement this solution with frames, but I would rather not...

Look up "server side include" or "php include"
 
E

Ed Mullen

Ed said:
Not with CSS.



And you shouldn't. Use server side includes, PHP, ASP, JSP or some
other serve side technology.

And if your ISP doesn't provide such technology, you can do it with
javascript. There are some people who don't allow javascript while
browsing so you'll need to decide if that matters to you.
 
E

Ed Seedhouse

And if your ISP doesn't provide such technology, you can do it with
javascript. There are some people who don't allow javascript while
browsing so you'll need to decide if that matters to you.

Good points, I should have mentioned javascript and the problem with it
myself.
 
N

nice.guy.nige

While the city slept, Ed Mullen ([email protected]) feverishly typed...

[server side includes]
And if your ISP doesn't provide such technology, you can do it with
javascript. There are some people who don't allow javascript while
browsing so you'll need to decide if that matters to you.

The most important visitor your site could ever have does not have
javascript enabled. This visitor's name is "googlebot". Think very carefully
before you exclude content from this visitor ;-)

Cheers,
Nige
 
E

Ed Mullen

nice.guy.nige said:
While the city slept, Ed Mullen ([email protected]) feverishly typed...

[server side includes]
And if your ISP doesn't provide such technology, you can do it with
javascript. There are some people who don't allow javascript while
browsing so you'll need to decide if that matters to you.

The most important visitor your site could ever have does not have
javascript enabled. This visitor's name is "googlebot". Think very carefully
before you exclude content from this visitor ;-)

Cheers,
Nige

Actually, Google has many Webmaster tools to account for this. And,
careful design can handle the rest.

I use javascript to create my menus on the fly. Still, every link on my
site of about 200 pages is listed in Google. At the top? That's
another question. ;-)

The bugaboo about javascript is just that, unfounded in practice. And,
given that many major ISPs don't provide server-side solutions, it may
be the only viable alternative.

Will a few paranoiacs be inconvenienced visiting my site? Maybe. I
don't care. It's a hobby for me. I'm not careless about my hobbies but
I'm not obsessed about them, either. And I DO provide a site map so
that the truly paranoid can find all the pages.

And I do ascribe to the Lincolnesque observation about pleasing all the
people all time: It cannot be done. So I have evaluated my own
situation and made my choices. And have done so knowing the trade-offs.
And, in five years I've never had anyone object to the use of
javascript on my site, but I have had many emails of thanks.

Hey, again, it's not ibm.com (which uses javascript) but I'm doing ok.
And so is IBM. And msn.com. And yahoo.com. And amazon.com etc. Geez,
people. Lighten up. javascript isn't evil.
 
A

Adrienne Boswell

And if your ISP doesn't provide such technology, you can do it with
javascript. There are some people who don't allow javascript while
browsing so you'll need to decide if that matters to you.

Or consider a preprocessor.
 
A

Adrienne Boswell

Gazing into my crystal ball I observed Hans-Peter Diettrich <DrDiettrich1
@aol.com> writing in
Why not? Can a CSS file not contain visible text?

No, an external style sheet is just that, a Style Sheet, only affecting
presentation of the document's markup. The only time you would see text
from a stylesheet is in the case of the Content property, used in
conjunction with :before and :after pseudo-elements.
 
B

Beauregard T. Shagnasty

Adrienne said:
Hans-Peter Diettrich said:
Ed Seedhouse wrote:
[[email protected] wrote:]
if I have a footer that I want to be displayed on every page but I
only want to update it in one place (perhaps a single HTML file)
how can I get it to display on every page on my site?

Not with CSS.

Why not? Can a CSS file not contain visible text?

No, an external style sheet is just that, a Style Sheet, only
affecting presentation of the document's markup. The only time you
would see text from a stylesheet is in the case of the Content
property, used in conjunction with :before and :after
pseudo-elements.

...with the caveat that it will not work in the oft-used browser-like
operating system component.

#contentbox:after {
content: "Copyright 2007. All rights reserved.";
}

Note you can't place any HTML in this content.
 
H

Hans-Peter Diettrich

Beauregard said:
...with the caveat that it will not work in the oft-used browser-like
operating system component.

#contentbox:after {
content: "Copyright 2007. All rights reserved.";
}

Note you can't place any HTML in this content.

Thanks for all your answers :)

Another idea: what about browser-plugins?

In general it might be a bad idea, to force users to install a plugin
before they can see a particular page - what if everybody would do that?
But in my current project the users would be happy, if they could extend
the browser capabilities as desired, by installing a plugin.

Concrete question: what's the task of a plugin, what makes the browser
activate it? Is a plugin related to a special object type, or what else?

DoDi
 
B

Beauregard T. Shagnasty

Hans-Peter Diettrich said:
Beauregard said:
...with the caveat that it will not work in the oft-used browser-like
operating system component. [which is IE.]

#contentbox:after {
content: "Copyright 2007. All rights reserved.";
}

Note you can't place any HTML in this content.

Thanks for all your answers :)

Another idea: what about browser-plugins?

Is this for a public website? If only for an intranet, where you or
your company has full control, go for it, but if for the WWW, just drop
the idea.
In general it might be a bad idea, to force users to install a plugin
before they can see a particular page

This might apply only to a specialty site. Music.. videos.. but
certainly not for a simple footer.
- what if everybody would do that?

The WWW would be an even larger mess.
But in my current project the users would be happy, if they could
extend the browser capabilities as desired, by installing a plugin.

You should drop the idea of 'plugins' just to see text you want to
include in a file.
Concrete question: what's the task of a plugin, what makes the
browser activate it? Is a plugin related to a special object type, or
what else?

Can't be answered, as a 'plugin' could be a thousand things. I'm
certainly not going to install unnecessary 'plugins' in my browsers just
to see a copyright notice.

As the original post was about inserting common footer text on all
pages, the answer still remains to use either SSI, PHP includes or
similar, preprocessing, or an external JavaScript called by each page's
code. (Note that JavaScript will not be seen by 5-10% of visitors.)
 
H

Hans-Peter Diettrich

Beauregard said:
You should drop the idea of 'plugins' just to see text you want to
include in a file.

It's more complicated than that. I have to preprocess HTML Help pages,
which contain links as <MSHelp.link ...> tags. Actually I have no idea
how to make such links work, other than replacing them by ordinary <A
....> elements. But I'm looking for alternatives, perhaps some guru can
point me into a better direction.

DoDi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top