You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Brian Enigma <en...@netninja.com> on 2003/12/07 21:47:25 UTC

Generating Non-HTML File Extensions?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

     I have been through the online documentation and mailing list 
archives, but did not find an answer to this question (it was asked, 
but not answered, in September).  Basically, I have an existing site 
that I would like to scrap and redo using Forrest (generated offline 
and rsync'ed over SSH).  While the majority of the site is static, 
there is a page or two of PHP.  Now, I do not care whether the PHP is 
embedded in one of the xdocs/ files or done by hand.  I can deal with 
either method since it is a small number of files.

     What I would really prefer, though, is not to play musical file 
extensions.  For consistency (as well as for my own personal sense of 
aesthetics), I would like to generate the static content with a .php 
file extension.  Running static content through the PHP parser adds 
very little overhead, but also allows me to add PHP content to future 
versions of those static pages.  Users are going to have to change 
their existing links/bookmark into this site when I switch to Forrest 
because I want to clean up the directory structure.  I would rather not 
force them to do it again if I decide to add dynamic PHP content to a 
currently static page.

     Is it possible to change the generated extension from .html to 
.php?  If so, how?
  -Brian

References:
Unanswered question about changing the generated file extension
http://marc.theaimsgroup.com/?l=forrest-dev&m=106389645914445&w=2

Start of long conversation about embedding PHP in the XML
http://marc.theaimsgroup.com/?l=forrest-dev&m=103640402515196&w=2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQE/05Hh0dKNWt3rpSURAgPOAJ4sg2MaN/QamCF4z0v0PgKAtoqx5ACeK8oO
zdqOO6XgGFfDEAqS6DTJ1qk=
=PbyF
-----END PGP SIGNATURE-----


Re: Generating Non-HTML File Extensions?

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Marshall Roch wrote:

> Brian Enigma wrote:
> 
>>     What I would really prefer, though, is not to play musical file 
>> extensions.  For consistency (as well as for my own personal sense of 
>> aesthetics), I would like to generate the static content with a .php 
>> file extension.  
> 
> 
> There are a lot of debates about this.  Even .html won't last forever. 
> The best way to deal with it is to not use extensions at all.
> 
> Tim Berners-Lee (creator of HTML and the W3C) wrote something about this 
> a few years ago:
> 
> http://www.w3.org/Provider/Style/URI.html
> 
> and more specifically, http://www.w3.org/Provider/Style/URI.html#remove
> 
> I'm not sure if it's possible with Forrest, but this is something I've 
> done successfully with Apache and PHP in the past, and will be trying 
> with Forrest in a few days.

Forrest should work similarly, and we had discussions on this.

At that time, we had also decided on a format, something like:

  <link href="path-to-file" preferred-type="txt/html">text</link>

so that we could also specify the type of output that was preferred in 
case the client could accept the page in more formats.

This has not yet been done, and IMHO it's the next step to do after 
site.xml WRT linking.

Since we have decided to switch to XHTML2 as a next format, we should 
now see how that defines such a mechanism.

> If you use Apache as a front-end (i.e. Apache takes the request and 
> sends it to Tomcat, which sends it to Forrest), you can use 
> mod_negotiation, which allows you to eliminate file extensions altogether.
> 
> See the 2nd link above for more info on how it works.
> 
> IIRC, all you have to do to turn it on is add "Options +MultiViews" to 
> your .htaccess or httpd.conf file.
> 
> See also: http://www.alistapart.com/articles/urls

Basically, by using site.xml half is done, as content writers use 
indirect linking without extensions.

The rest should be done by Forrest, and Cocoon is very capable of it 
(@see the Cocoon docs http://cocoon.apache.org/). The problem here is 
that Cocoon is being used primarily for generating docs statically, 
while to do this one would need to run Cocoon live.

Thus we would need to have Forrest generate the whole site with all 
content types statically, also with the informations for Apache on how 
to do negotiation.

This would be really awesome, and it's wating for a taker :-)

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Re: Generating Non-HTML File Extensions?

Posted by Marshall Roch <ma...@exclupen.com>.
Brian Enigma wrote:
>     What I would really prefer, though, is not to play musical file 
> extensions.  For consistency (as well as for my own personal sense of 
> aesthetics), I would like to generate the static content with a .php 
> file extension.  

There are a lot of debates about this.  Even .html won't last forever. 
The best way to deal with it is to not use extensions at all.

Tim Berners-Lee (creator of HTML and the W3C) wrote something about this 
a few years ago:

http://www.w3.org/Provider/Style/URI.html

and more specifically, http://www.w3.org/Provider/Style/URI.html#remove

I'm not sure if it's possible with Forrest, but this is something I've 
done successfully with Apache and PHP in the past, and will be trying 
with Forrest in a few days.

If you use Apache as a front-end (i.e. Apache takes the request and 
sends it to Tomcat, which sends it to Forrest), you can use 
mod_negotiation, which allows you to eliminate file extensions altogether.

See the 2nd link above for more info on how it works.

IIRC, all you have to do to turn it on is add "Options +MultiViews" to 
your .htaccess or httpd.conf file.

See also: http://www.alistapart.com/articles/urls

--
Marshall Roch