You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "S.A. Birl" <sb...@concept.temple.edu> on 2006/02/18 21:26:48 UTC

[users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Im sure this has been asked before, but I was unable to find a
suitable query to search the httpd-users list with:

Is it possible to have Apache 2.0.53 to append HTML information to
pages as they are being served out?  Similar to 'Header append', but
for the body?

I looked at all of Add* modules on the website, and couldnt think of
anything that matches.  Im not sure if mod_asis or mod_cern_meta would
help.


Or does someone know of an easy way to append
	<META NAME="robots" CONTENT="noarchive">
to 100+ files?



Thanks
 Birl

Please do not CC me responses to my own posts.
I'll read the responses on the list.

Archives   http://mail-archives.apache.org/mod_mbox/httpd-users/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Posted by "S.A. Birl" <sb...@concept.temple.edu>.
On Feb 19, Nick Kew (nospam-nick@webthing.com.ns) typed:

Nick:  On Sunday 19 February 2006 01:50, Eugene wrote:
Nick:
Nick:  But not relevant to the question, unless you have hooks in place
Nick:  (as in SSI).
Nick:
Nick:  > There's also a 3rd-party module
Nick:  > called mod_layout that does the trick too.
Nick:
Nick:  I'd point the OP at mod_publisher which, unlike mod_layout,
Nick:  is markup-aware and won't risk breaking a page (and I'm not
Nick:  sure how reliably mod_layout can find the right place to insert
Nick:  contents).
Nick:
Nick:  On the other hand, preprocessing is probably better than any
Nick:  solution using apache.
Nick:
Nick:  > : Or does someone know of an easy way to append
Nick:  > : 	<META NAME="robots" CONTENT="noarchive">
Nick:  > : to 100+ files?
Nick:
Nick:  If you have an easy-to-find hook (like the byte sequence "</head>")
Nick:  just run a global edit, e.g. with perl.  I think it's safe to say that if
Nick:  you can fix it with mod_layout, you can fix it more easily with a
Nick:  simple perl one-liner.  But I'm willing to be proved wrong:-)


On Feb 19, Nick Kew (nospam-nick@webthing.com.ns) typed:

Nick:  On Sunday 19 February 2006 08:40, httpd2@karsites.net wrote:
Nick:  > If you use only one page header for all your html files, you
Nick:  > can then use that one instance for all of the pages on your
Nick:  > site by including it with something like
Nick:  >
Nick:  > <?php require "../incs/page-head.php"; ?>
Nick:
Nick:  That would be a very bad solution, several times over.
Nick:
Nick:  Firstly, it means preprocessing.  And why would one preprocess
Nick:  to that rather than to add in the required line directly?  Or if
Nick:  future flexibility is an issue, to add it as SSI which can be enabled/
Nick:  disabled at will without breaking the pages?
Nick:
Nick:  Secondly, it loses flexibility.  Not just a little, but hugely, because
Nick:  PHP - unlike SSI or any of the other apache-based solutions -
Nick:  doesn't run as a filter.
Nick:
Nick:  Thirdly it imposes an extra load on the server.  That could be
Nick:  quite modest, but for any user who has to ask the question
Nick:  in the first place, it's likely to be very substantial, because he's
Nick:  unlikely to have the expertise to use PHP without destroying
Nick:  cacheability.
Nick:
Nick:  > at the top of each html page, where the <head>...</head>
Nick:  > section would normally reside.
Nick:
Nick:  How many sites have identical <title>s on all pages?
Nick:
Nick:  > Then, you only need to make one change to the included
Nick:  > page-head.php file, to affect all the pages on your site.
Nick:
Nick:  SSI would do that more flexibly.  As would mod_publisher or
Nick:  mod_layout, without requiring the pages to be edited in the
Nick:  first place.
Nick:
Nick:  But as I already said, the best solution is almost certainly
Nick:  none of the above.




Interesting suggestions Nick.  I do have mod_include compiled in.


Im wonder though if using:
<Directory blah>
	DirectoryIndex /cgi-bin/norobots.pl
</Directory>

would be easier than a 3rd party module?



Have the PERL script do something roughly like:
	print "Content-type: text/html\n\n";
	my $FILE = $ENV{"REQUEST_URI"};
	open $FILE or die;
	while (<INPUT>)
	{
		if ($_ =~ /<\/head>/)
		{
			print "<META NAME="robots" CONTENT="noarchive">\n";
		}
		print $_;
	}


(of course this is just psudo-code off the top of my head)

Not sure what that would do to the server load.




Hmmm ... maybe I'll just use PERL to modify to the files like you
said above.




Thanks
 Birl

Please do not CC me responses to my own posts.
I'll read the responses on the list.

Archives   http://mail-archives.apache.org/mod_mbox/httpd-users/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Posted by ht...@karsites.net.
Thankyou for your comments Nick. I will look into the 
modules you mentioned below.

This may not be relevant, but I note in the php manual,
php4 and php5 support the concept of handlers.

Is this in any way related to filters Nick?

# PHP 4
AddHandler php-script php
AddType text/html php

# PHP 5
AddHandler php5-script php
AddType text/html php


Keith

In theory, theory and practice are the same;
In practice they are not. 

On Sun, 19 Feb 2006, Nick Kew wrote:

> To: users@httpd.apache.org
> From: Nick Kew <ni...@webthing.com>
> Subject: Re: [users@httpd] Force/add/append/inject HTML to documents (similar
>     to 'Header append') for no archive
> 
> On Sunday 19 February 2006 08:40, httpd2@karsites.net wrote:
> > If you use only one page header for all your html files, you
> > can then use that one instance for all of the pages on your
> > site by including it with something like
> >
> > <?php require "../incs/page-head.php"; ?>
> 
> That would be a very bad solution, several times over.
> 
> Firstly, it means preprocessing.  And why would one preprocess
> to that rather than to add in the required line directly?  Or if
> future flexibility is an issue, to add it as SSI which can be enabled/
> disabled at will without breaking the pages?
> 
> Secondly, it loses flexibility.  Not just a little, but hugely, because
> PHP - unlike SSI or any of the other apache-based solutions -
> doesn't run as a filter.
> 
> Thirdly it imposes an extra load on the server.  That could be
> quite modest, but for any user who has to ask the question
> in the first place, it's likely to be very substantial, because he's
> unlikely to have the expertise to use PHP without destroying
> cacheability.
> 
> > at the top of each html page, where the <head>...</head>
> > section would normally reside.
> 
> How many sites have identical <title>s on all pages?
> 
> > Then, you only need to make one change to the included
> > page-head.php file, to affect all the pages on your site.
> 
> SSI would do that more flexibly.  As would mod_publisher or
> mod_layout, without requiring the pages to be edited in the
> first place.
> 
> But as I already said, the best solution is almost certainly
> none of the above.
> 
> -- 
> Nick Kew
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Posted by Nick Kew <ni...@webthing.com>.
On Sunday 19 February 2006 08:40, httpd2@karsites.net wrote:
> If you use only one page header for all your html files, you
> can then use that one instance for all of the pages on your
> site by including it with something like
>
> <?php require "../incs/page-head.php"; ?>

That would be a very bad solution, several times over.

Firstly, it means preprocessing.  And why would one preprocess
to that rather than to add in the required line directly?  Or if
future flexibility is an issue, to add it as SSI which can be enabled/
disabled at will without breaking the pages?

Secondly, it loses flexibility.  Not just a little, but hugely, because
PHP - unlike SSI or any of the other apache-based solutions -
doesn't run as a filter.

Thirdly it imposes an extra load on the server.  That could be
quite modest, but for any user who has to ask the question
in the first place, it's likely to be very substantial, because he's
unlikely to have the expertise to use PHP without destroying
cacheability.

> at the top of each html page, where the <head>...</head>
> section would normally reside.

How many sites have identical <title>s on all pages?

> Then, you only need to make one change to the included
> page-head.php file, to affect all the pages on your site.

SSI would do that more flexibly.  As would mod_publisher or
mod_layout, without requiring the pages to be edited in the
first place.

But as I already said, the best solution is almost certainly
none of the above.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Posted by ht...@karsites.net.
If you use only one page header for all your html files, you 
can then use that one instance for all of the pages on your 
site by including it with something like

<?php require "../incs/page-head.php"; ?>

at the top of each html page, where the <head>...</head> 
section would normally reside.

Then, you only need to make one change to the included 
page-head.php file, to affect all the pages on your site.

Keith

In theory, theory and practice are the same;
In practice they are not. 

On Sat, 18 Feb 2006, S.A. Birl wrote:

> To: users@httpd.apache.org
> From: S.A. Birl <sb...@concept.temple.edu>
> Subject: [users@httpd] Force/add/append/inject HTML to documents (similar to
>     'Header append') for no archive
> 
> Im sure this has been asked before, but I was unable to find a
> suitable query to search the httpd-users list with:
> 
> Is it possible to have Apache 2.0.53 to append HTML information to
> pages as they are being served out?  Similar to 'Header append', but
> for the body?
> 
> I looked at all of Add* modules on the website, and couldnt think of
> anything that matches.  Im not sure if mod_asis or mod_cern_meta would
> help.
> 
> 
> Or does someone know of an easy way to append
> 	<META NAME="robots" CONTENT="noarchive">
> to 100+ files?
> 
> 
> 
> Thanks
>  Birl
> 
> Please do not CC me responses to my own posts.
> I'll read the responses on the list.
> 
> Archives   http://mail-archives.apache.org/mod_mbox/httpd-users/
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Posted by Nick Kew <ni...@webthing.com>.
On Sunday 19 February 2006 01:50, Eugene wrote:
> On Sat, Feb 18, 2006 at 02:26:48PM CST, S.A. Birl 
<sb...@concept.temple.edu> wrote:
> : Is it possible to have Apache 2.0.53 to append HTML information to
> : pages as they are being served out?  Similar to 'Header append', but
> : for the body?
> :
> : I looked at all of Add* modules on the website, and couldnt think of
> : anything that matches.  Im not sure if mod_asis or mod_cern_meta would
> : help.
>
> Apache doesn't do this by itself.

Indeedie.

> There are several template-ish 
> solutions involving mod_rewrite.

But not relevant to the question, unless you have hooks in place
(as in SSI).

> There's also a 3rd-party module 
> called mod_layout that does the trick too.

I'd point the OP at mod_publisher which, unlike mod_layout,
is markup-aware and won't risk breaking a page (and I'm not
sure how reliably mod_layout can find the right place to insert
contents).

On the other hand, preprocessing is probably better than any
solution using apache.

> : Or does someone know of an easy way to append
> : 	<META NAME="robots" CONTENT="noarchive">
> : to 100+ files?

If you have an easy-to-find hook (like the byte sequence "</head>")
just run a global edit, e.g. with perl.  I think it's safe to say that if
you can fix it with mod_layout, you can fix it more easily with a
simple perl one-liner.  But I'm willing to be proved wrong:-)

> You actually don't want to append.  That stuff needs to go in the
> <TITLE> section, which is at the top of the file.

YM the <head>

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Force/add/append/inject HTML to documents (similar to 'Header append') for no archive

Posted by Eugene <li...@fsck.net>.
On Sat, Feb 18, 2006 at 02:26:48PM CST, S.A. Birl <sb...@concept.temple.edu> wrote:
: 
: Is it possible to have Apache 2.0.53 to append HTML information to
: pages as they are being served out?  Similar to 'Header append', but
: for the body?
: 
: I looked at all of Add* modules on the website, and couldnt think of
: anything that matches.  Im not sure if mod_asis or mod_cern_meta would
: help.

Apache doesn't do this by itself.  There are several template-ish
solutions involving mod_rewrite.  There's also a 3rd-party module
called mod_layout that does the trick too.

	<http://tangent.org/index.pl?lastnode_id=478&node_id=362>

: Or does someone know of an easy way to append
: 	<META NAME="robots" CONTENT="noarchive">
: to 100+ files?

You actually don't want to append.  That stuff needs to go in the
<TITLE> section, which is at the top of the file.


-- 
Eugene

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org