modular code

Discussion in 'HTML' started by cbnewman@gmail.com, Jun 11, 2007.

Guest

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...

Advertisements

On Mon, 11 Jun 2007 01:50:38 -0000, wrote:
>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.

Advertisements

In article
<>, wrote:
> 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...

Ed Seedhouse wrote:
> On Mon, 11 Jun 2007 01:50:38 -0000, wrote:
>
>> 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.
>
>

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.

On Sun, 10 Jun 2007 22:15:20 -0400, Ed Mullen <> wrote:
>Ed Seedhouse wrote:
>> On Mon, 11 Jun 2007 01:50:38 -0000, wrote:
>>
>>> 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.
>>
>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.

[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 ;-)

nice.guy.nige wrote:
> While the city slept, Ed Mullen () 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.

Gazing into my crystal ball I observed Ed Mullen <>
writing in news::
> Ed Seedhouse wrote:
>> On Mon, 11 Jun 2007 01:50:38 -0000, wrote:
>>
>>> 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?
>>> 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.
>
> 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.
>

Ed Seedhouse 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.

Gazing into my crystal ball I observed Hans-Peter Diettrich <DrDiettrich1
@aol.com> writing in news::
> Ed Seedhouse 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.

Adrienne Boswell wrote:
> Hans-Peter Diettrich wrote:
>> Ed Seedhouse wrote:
>> [ 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.

Beauregard T. Shagnasty wrote:
>>>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.

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?

Hans-Peter Diettrich wrote:
> Beauregard T. Shagnasty wrote:
>> ...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.)

Beauregard T. Shagnasty wrote:
>>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.

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.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!