Use .css to insert small "Donate" one-liner on top of all pages?

I

I.N. Galidakis

Hi,

I am a total noob to html 4.01 and was wondering if I could use some simple css
to insert a simple one-line banner to all the pages of my web site with a link
to my "Donate" page.

It is fairly impossible to insert such a one-liner on all pages of the web site
as they are in excess of 300, so I was wondering if I could achieve something
similar to what wiki does (for its calls for donation), which would consist of
only some text and a link to my "Donate" page.

I only use two very simple .css docs, which just control the appearance of the
documents on my web page and which can be inspected with "Display Source" on IE.

The one-liner I had in mind, should be something simple, like:

"Please read the Donate page", with the word "Donate" linking to my regular
"Donate" on the upper menu.

This, should be followed by a <hr> and the page should continue normally.

For example:

-------------------Page top --------
Please read the Donate page!
<hr>
Web page contents continue normally.
.....

Regular meta commands like "insert" .html ("include", etc.) don't work, because
the yahoo server doesn't support them.

Many thanks,
 
J

Jonathan N. Little

I.N. Galidakis said:
Hi,

I am a total noob to html 4.01 and was wondering if I could use some
simple css to insert a simple one-line banner to all the pages of my web
site with a link to my "Donate" page.

Although CSS has a mechanism for generation content, it is limited and
not meant for "content" content, i.e., but more "styling" content.
Examples like numbers on lists, images or content type indications on
links, etc. and not actual page content.

/* content hints */
a.external:after { content: " " url(external.png); }
a[href$=".pdf"]:after { content: " " url(pdf.png); }
a[href$=".bmp"]:after { content: " " url(image.png); }
a[href^="mailto"]:after { content: " " url(email.png); }

What you want is server side includes to included a common content on
each page. You need SSI, or PHP, or ASP, or whatever your hosting supports.
 
D

dorayme

I.N. Galidakis said:
I am a total noob to html 4.01 and was wondering if I could use some simple
css to insert a simple one-line banner to all the pages of my web site
with a link to my "Donate" page.

Usually, the best way to insert some specific markup on a lot of
pages is to write it once in a text file, name the file and refer
to it with an *include* on all the pages. You can use Server Side
Includes or PHP Includes. But you go on to say your server does
not support these?

You are very limited by the ability of CSS to put in content. You
can put in a bit of text via CSS but it would not operate a link.
You can *refer* to a link on the page, you seem to have one. But
your problem will be to find a suitable element that you already
have there to latch onto. If you have to insert a new element for
the purpose on every page, that would defeat the purpose somewhat
and you would be better off sticking a proper bit of markup with
a link on each page.

You do have an element, an HR at the start. If you did not have
any other HRs on the pages you might be able to get away with
something like::

hr:before {
color: #c00;
background: #cfc;
padding: .5em;
line-height: 2;
content: "Please read the Donate page, see link on the main menu
below."
}


Or even, instead of the above text bit: "Please read the Donate
page which is at http:/..." It would at least give the address.
 
B

Ben Bacarisse

dorayme said:
Usually, the best way to insert some specific markup on a lot of
pages is to write it once in a text file, name the file and refer
to it with an *include* on all the pages. You can use Server Side
Includes or PHP Includes. But you go on to say your server does
not support these?

This would still require all the 300-odd pages to be edited to include
the include, and the OP has expressed (understandable) reluctance to do
that.

I'd say that this is the key issue. Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I tend to use an off-line template or macro system for this sort of
thing. The resulting pages don't need any server-side assistance, and
yet bulk changes are very easy to make. This only works for a
particular kind of site, so I would not suggest the OP learn any such
method for a once-off job, whereas bulk editing is likely to come in
handy for all sorts of things.

[1] It's wise to add some sort of marker so that you can target any
later edits more simply:

<!-- Donate banner start -->
...
<p>These pages don't write themselves, you know.</p>
...
<!-- Donate banner end -->

<snip>
 
D

Denis McMahon

I'd say that this is the key issue. Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I'd use something like the following in each directory:

sed -i 's|\(<body[^>]*>\)|\1<p><a href="/donate.htm">Please Donate</a></
p>|' *.htm

Which (untested) would insert a single para after the <body> tag in each
htm file, said para containing a link to donate.htm and the text "Please
Donate".

Using "/donate.htm" means you don't need to rewrite the replace
expression to accommodate different levels of directory nesting.

It reduces 300 open, paste, save operations to one command per directory,
which I imagine is an improvement. Unfortunately sed does not support
recursive searches .... although perhaps it could be used in an exec with
find (also untested):

find . -name *.htm -exec sed -i 's|\(<body[^>]*>\)|\1<p><a href="/
donate.htm">Please Donate</a></p>|' '{}' \;

I use the fully qualified url in this example as there's no easy way to
allow for the nesting level doing it that way.

Of course, both of these methods rely on having useful command line tools
and an environment in which they can be used. I believe sed and find are
available for microsoft cli these days at eg <url:http://
unxutils.sourceforge.net/> although they may not use exactly the same
syntaxes as the ones I'm used to.

Rgds

Denis McMahon
 
D

dorayme

<[email protected]
k>,
Ben Bacarisse said:
This would still require all the 300-odd pages to be edited to include
the include, and the OP has expressed (understandable) reluctance to do
that.
I'd say that this is the key issue.

True, which is why I addressed this in the rest of my post.
Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I tend to use an off-line template or macro system for this sort of
thing. ...

Yes, I used to do a lot of this before using includes. In the Mac
world BBEdit and TextWrangler have always had good F&R facilities
including global changes over folders and GREP.

It was a nuisance on dial-up because one still had to upload a
lot of pages yet now I am fast cable, it is still absurdly slow
uploading! (I had the best upload speeds on ADSL for years. Now I
have blazing downloads and turtle uploads!)
 
D

dorayme

Denis McMahon said:
I'd say that this is the key issue. Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I'd use something like the following in each directory:

sed -i 's|\(<body[^>]*>\)|\1<p><a href="/donate.htm">Please Donate</a></
p>|' *.htm

So much cooler and geekier than the simple-minded, dumb, low-rent

Find:

body>

Replace:

body>
<p><a href="http://domain/donate.htm">Please Donate</a></p>
 
J

Jonathan N. Little

dorayme said:
Denis McMahon said:
I'd say that this is the key issue. Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I'd use something like the following in each directory:

sed -i 's|\(<body[^>]*>\)|\1<p><a href="/donate.htm">Please Donate</a></
p>|' *.htm

So much cooler and geekier than the simple-minded, dumb, low-rent

Find:

body>

Replace:

body>
<p><a href="http://domain/donate.htm">Please Donate</a></p>

....and faster. sed uses a glob to edit all 300+ files over manually
opening each file to F/R
 
D

dorayme

Jonathan N. Little said:
dorayme said:
Denis McMahon said:
On Wed, 23 Nov 2011 00:58:44 +0000, Ben Bacarisse wrote:

I'd say that this is the key issue. Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I'd use something like the following in each directory:

sed -i 's|\(<body[^>]*>\)|\1<p><a href="/donate.htm">Please Donate</a></
p>|' *.htm

So much cooler and geekier than the simple-minded, dumb, low-rent

Find:

body>

Replace:

body>
<p><a href="http://domain/donate.htm">Please Donate</a></p>

...and faster. sed uses a glob to edit all 300+ files over manually
opening each file to F/R

Manually? Does my BBedit text editor have hands?

Or do you think you can't use the simple-minded, dumb, low-rent
one to replace over a whole folder in one go? The text is low
geek but the editor is smart as hell. I have been trying to
persuade you, Jonathan, for how many years?, to come over from
the dark side. <g>
 
B

Ben Bacarisse

dorayme said:
<[email protected]
k>,
Ben Bacarisse <[email protected]> wrote:
Learning methods to modify large
collections of files at once almost always pays off over the years, and
doing so would provide a direct solution: just edit the pages to include
the desired text directly[1].

I tend to use an off-line template or macro system for this sort of
thing. ...

Yes, I used to do a lot of this before using includes. In the Mac
world BBEdit and TextWrangler have always had good F&R facilities
including global changes over folders and GREP.

It was a nuisance on dial-up because one still had to upload a
lot of pages yet now I am fast cable, it is still absurdly slow
uploading! (I had the best upload speeds on ADSL for years. Now I
have blazing downloads and turtle uploads!)

How true. It's a shame that hosting companies often don't support diff.
On Unixy servers with shell access, it often pays to upload a patch
rather than the changed pages themselves. It also gives one a handy
'undo' option for those "what was I thinking?" moments. (And if you use
change control on the pages, you get the patch for free).

On non-shell hosts, I would find a GUI-based "patch the site" option
very useful at times.
 
B

Beauregard T. Shagnasty

Denis said:
I'd use something like the following in each directory:

sed -i 's|\(<body[^>]*>\)|\1<p><a href="/donate.htm">Please Donate</a></
p>|' *.htm

Which (untested) would insert a single para after the <body> tag in each
htm file, said para containing a link to donate.htm and the text "Please
Donate".

That's the first thing I thought of, Denis. 'Cept none of his pages have
a <body> tag. :)


</head>

<hr>
<center>


'Course, I suppose for a first run, he could *add* the missing <body>
tag. They do have the closing </body> tag, though. Strange...
 
J

Jonathan N. Little

dorayme said:
Manually? Does my BBedit text editor have hands?

OP: X-Newsreader: Microsoft Outlook Express 6.00.2900.5931

I don't think so.
Or do you think you can't use the simple-minded, dumb, low-rent
one to replace over a whole folder in one go? The text is low
geek but the editor is smart as hell. I have been trying to
persuade you, Jonathan, for how many years?, to come over from
the dark side.<g>

Okay now you have done it, you got me on a tear!

<rant>
I build my own computers to my specifications. Why would I buy a
computer with a price premium with diminished specs and limited choice
of software saddled with DRM that makes Microsoft-ware look like "Open
Source"?

I use standard components and upgrade frequently over years for a
system, (this new one replace a maxed-out P4 system where some
components were a decade old). Switch that for where "system upgrade" is
a euphemism for replace with new model?

I like the OS to look nice, but ultimately I *need* to get stuff done.
Icons may be pretty but I still believe data stored in a hierarchical
structure and browsed by sortable tabular lists is by far more efficient
than piles of icons and tagged searches. I have no trouble finding stuff
with 570GB over 2.5TB of drives.

And now EVERYBODY is trying to emulate a bleeping MAC (oops worse, a
CELLPHONE) I have a dual boot Win7 and Ubuntu Ocelot, also Windows VM
with WinXP for some old necessary programs, and just installed
VirtualBox and have Ocelot in a VM (more handy than the dual boot but I
lose my dual monitors).

I was not crazy with Seven, and frustrated with the damn Library refresh
bug. Never liked MS's stupid drive letters and love FHS. Use Ubuntu for
my servers and laptops, but some software I need for business prevents
me from dumping Windows. Ubuntu's GNOME2 weened me from KDE, but this
new Unity thing...I am trying to see the value. Shuttleworth must be
infatuated with Jobs. Since 90% of the population are right-handed why
put the window widgets on the right? And why in hell rip the the
window-menu from the associated window and stick it up on the top
panel?!!!! Fine for a freaking cell phone or touch tablet, but I've got
two monitors! Aside of the confusion of which window the menu is
associated with (not an issue when it was affixed to that window) but I
have to swing my mouse cross-country to access it! Not going to do
touch. I "disarm" anyone who puts grubby finger prints on my monitors!!!

I am not against change, but change just for change sake? There should
be some advantage. Change what can be improved, but keep what works.
</rant>

See now you did it! ;-)
 
I

I.N. Galidakis

dorayme said:
Denis McMahon said:
I'd say that this is the key issue. Learning methods to modify
large collections of files at once almost always pays off over the
years, and doing so would provide a direct solution: just edit the
pages to include the desired text directly[1].

I'd use something like the following in each directory:

sed -i 's|\(<body[^>]*>\)|\1<p><a href="/donate.htm">Please
Donate</a></ p>|' *.htm

So much cooler and geekier than the simple-minded, dumb, low-rent

Find:

body>

Replace:

body>
<p><a href="http://domain/donate.htm">Please Donate</a></p>

Yes, yes, and yes! Thanks.

That's what came out after I banged my head a bit, as well.

It is a bit tedious, but my .html editor WinEdt, has similar search-replace ops
to BBEdit. No grep search, but still, WinEdt can do global doc replace.

Then, uploading would be a jiffy, once I perform a search/replace on all open
docs. All docs do have a <body> tag, so it's no problem.

The yahoo server does not support server side includes for some odd reason.

This reply comes from aioe.org, since NONE of the responses are seen from my
regular service server. Seems everything is going down, again :-(

Thanks to everyone!
 
B

Beauregard T. Shagnasty

I.N. Galidakis said:
Then, uploading would be a jiffy, once I perform a search/replace on all
open docs. All docs do have a <body> tag, so it's no problem.

As I mentioned about twelve hours ago, none of your pages that I looked
at have a <body> tag.
 
I

I.N. Galidakis

Beauregard said:
As I mentioned about twelve hours ago, none of your pages that I
looked at have a <body> tag.

WhoOps! How the heck did they validate?

The appropriate time to add it, then.

Thanks,
 
D

Denis McMahon

... I have ... Ubuntu Ocelot,

How's that working out? I'm sitting on Narwhal while I decide where to go
next, I understand mint has added some stuff on top of gnome 3 that makes
it look more like gnome 2, which is tempting - I like gnome 2.

Maybe I should Xubuntu? Xfce might be preferable to Gnome 3. Although I
understand they changed from GDM to something else too ....

Rgds

Denis McMahon
 
J

Jonathan N. Little

Denis said:
How's that working out? I'm sitting on Narwhal while I decide where to go
next, I understand mint has added some stuff on top of gnome 3 that makes
it look more like gnome 2, which is tempting - I like gnome 2.

Well Ocelot is better than Narwhal like getting jabbed with a stick in
the foot is better than the eye.
Maybe I should Xubuntu? Xfce might be preferable to Gnome 3. Although I
understand they changed from GDM to something else too ....

Lubuntu may be closer, but I think the writing is on the wall. The
Wozniaks are supplanted by the Jobs...the PC as a generic tool with
endless applications only limited by the user's ingenuity to an
appliance restricted by the designer to a specific application to
maximize sales...so the functional adaptable GUI falls to the fixed
Fisher-Price GUI for the (insert you own derogatory descriptor) who only
diddles with the device...
 
D

dorayme

I.N. Galidakis said:
dorayme wrote: ....

Yes, yes, and yes! Thanks.

That's what came out after I banged my head a bit, as well.

It is a bit tedious, but my .html editor WinEdt, has similar search-replace
ops
to BBEdit. No grep search, but still, WinEdt can do global doc replace.

Then, uploading would be a jiffy, once I perform a search/replace on all open
docs. All docs do have a <body> tag, so it's no problem.

The yahoo server does not support server side includes for some odd reason.

This reply comes from aioe.org, since NONE of the responses are seen from my
regular service server. Seems everything is going down, again :-(


Optus, my ISP, dropped their news server the other day.

"Optus has previously provided usenet service
(Optus Newsgroup) to customers. However,
following evaluation of the services that we
offer to our customers, and the declining
usage of usenet by our customers over the
past several years, it is no longer viable to
continue to provide this service. As a
result, the usenet service is in the process
of being disabled and removed. This service
will close as of 21/11/2011.

If you still want to use usenet, there are a
number of commercial usenet providers that
will be able to provide this service to you."

I already had a few other newservers because Optus's had broken
down a few times in past years.

About your replacement, yes, you can do the above as long as you
catch what is on each page. I noticed, as did another
motorcyclist here, that there is no "<body> on some at least of
your pages. So while at it,

Find:
<html>

Replace:
<html>
<body>
<p class="donate"><a href="http://domain/donate.htm">Please
Donate</a></p>

And add whatever styles you like to the class of "donate".
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top