Lake McManus wrote:
Alright well if I haven't already made it blatantly obvious, I'm new to the 
whole Forrest/Cocoon thing, and the documentation is hardly useful for someone 
trying to figure out how to use it and more useful as a reference for someone 
who already knows it.  I'm also inexperienced with servlets, containers, and 
webapps, though I do know Java.  Would you mind explaining how I would 
integrate Forrest, along with other components such as PHP, into an Apache 
server, using what you mentioned below?  Thank you so much for your help, and 
for putting up with me!


Yes, it is true our docs could be imporved considerably. When you understand more we would welcome patches and contributions.

The best thing for me to do in answering your questions is to point you to docs that *should* answer your questions, you go and read them, experiment a little and come back here with more questions as they become more focussed on specific problems rather than wide, general issues.

First of all, using Forrest inside a Servlet engine alongside Apache HTTPD:

It is not really within the scope of this user list to get this configured. You will find more immediate help on the user list for your chosen serlet engine. If you do not currently have one then I recomend Apache Tomcat http://jakarta.apache.org/tomcat/

They have extensive docs on getting tomcat installed and deploying webapps.

Once you have this up and running you can create a webapp from Forrest with the command "forrest webapp", deploy the resulting war file in tomcat and off you go.

I suggest you first try deploying an unmodified seed site from forrest, see http://forrest.apache.org/#User-friendly for instructions on creating a seed site. Just replace step 4 and 5 with the above "forrest webapp" steps and you should be working.

Now to integrating PHP.

First of all, consider wether you really want to do this. PHP is an adequate language but there are, IMHO, opinion better languages available through Cocoon (on which Forrest is bilt). If you still want to work with PHP then here is what you do:

Play around with Forrest doing some static pages using XML first. Get used to how Forrest works. Integrating PHP is an advanced activity and as a newbie you should spend some time understanding Forrest in its simplest form first. Start with http://forrest.apache.org/docs_0_70/your-project.html

Conmfortable? Now re-read the advanced customisations section of the above page. This will give an example of how to customise the processing within Forrest. The part you are particularly interested in is the additions to the sitemap. There is a link to a sitemap reference in that section, you must read that reference - it is important background information.

By the time you have read all this you should know what to do. Here is a hint that you will not understand until you have read all the above:

<map:match pattern="**.php.xml">
    <map:generate src="http://localhost/{1}.php"; />
    <map:serialize type="xml"/>
</map:match>

This assumes that you php scripts output XDoc, if not then you will need a transformation to convert from the source format to XDoc (we have stylesheets and plugins for many formats so if this is the case ask before writing).

With this match requests for http:///domain.org/index.php.html will give a skinned HTML version of the page, http:///domain.org/index.php.pdf will give PDF etc.

There is *another* way of doing this Cocoon is able to execute PHP pages natively. However, I think the generator is deprecated now, so I'm not sure if you want to use that route.

Ross




--
Lake McManus~马雷~レイク・ミクマーナス~ْلَيكْ مِكْمَنُس~लेक् मिक्मानस
E-Mail: [EMAIL PROTECTED]
"Impermanent are all created things; strive on with awareness."

-----Original Message-----
From: Ross Gardler [mailto:[EMAIL PROTECTED] Sent: 2005 August 27 09:33
To: user@forrest.apache.org
Subject: Re: Forrest as a Module

Lake McManus wrote:

In my opinion, Forrest would be much more useful as a module.


Forrest is a webapp for hosting in a Servlet engine. It is a completely different beast to an HTTPD module (I guess that is what you mean by module). Of course, the servlet container itself can be run as an HTTPD module.


Despite what the Forrest website says, I can’t understand how Forrest can be used for dynamic pages


See our home page [1] and the docs at [2] which describes the dynamic mode in more detail.

In short you can do 'forrest run' and point your browser at http://localhost:8888 (the port is of course configurable, and you can poit at it from an external machine if you want to). In a production environment you probably want to do 'forrest webapp' and deploy on your favourite servlet container.

[1] http://forrest.apache.org/#Static+or+Dynamic
[2] http://forrest.apache.org/docs_0_70/your-project.html#webapp


Making it a module would allow this. That would make a lot more sense than having to run Forrest every time you update the site, especially if you’re not running Forrest on the server. At first I thought Forrest would be something like that, but it took me a while to realize, to my dismay, that it wasn’t.


On the contrary - that is *exactly* what forrest does when you run in dynamic mode. You should also appreciate that Forrest is designed to allow static content to be created since most content is, in fact, static and therefore is much more efficiently served by a web server. If you have dynamic needs then run in dynamic mode.


Having Forrest as a module would also increase functionality with server-site scripting like PHP. That way, PHP could produce Forrest-compatible code, and then Forrest would process it.


It already can. This is made really easy with the locationmap in 0.8-dev, however, it is still achievable in 0.7 if you write a custom sitemap for your project.

Furthermore, Forrest is built on top of Cocoon, so we have the full power of Cocoon in the dynamic environment.


Is there any effort being made toward this?


Errr... just in case you haven't noticed with my replies above, it already does everything you ask for :-P


And is there a reason that it wasn’t developed like a module or CGI in the first place?


Because it is much more powerful and efficient as a Cocoon application.

Ross