You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by "Gav...." <br...@brightontown.com.au> on 2006/01/21 13:06:23 UTC

Best way to add repeatable code in v2/v3 (was Re: Example use case)

Hi All,

On the right hand side of http://minitutorials.com I have some 'headlines' 
in a 'headlines' div
All boxes are in a 'rightbar' div also.
The code for this is in One file called rightnav.ssi and included using 
either 'include' or 'require'
This obviously has the effect that all of the site pages get the content 
from the one file.

I have been looking at how to do this using dispatcher method.

What I have tried :-

1. Create Hooks as required to get the div and css to position it.

 <forrest:hook name="headlines">
   <forrest:hook name="rightbar">
     <forrest:contract name="search-input">
            <forrest:properties contract="search-input">
              <forrest:property name="search-input">
                <search name="minitutorials" domain="www.minitutorials.com" 
provider="google"/>
              </forrest:property>
            </forrest:properties>
    </forrest:contract>
  </forrest:hook>
  </forrest:hook>

As you can see I have added a search-input so the div shows on the site and 
is present at http://apache.minitutorials.com

2. Then I looked through ls.contracts and found one I thought might be 
suitable as replacement of 'include/require'
Adding the code for it into my hooks above I ended up with :-

 <forrest:hook name="headlines">
   <forrest:hook name="rightbar">
     <forrest:contract name="search-input">
            <forrest:properties contract="search-input">
              <forrest:property name="search-input">
                <search name="minitutorials" domain="www.minitutorials.com" 
provider="google"/>
              </forrest:property>
            </forrest:properties>
    </forrest:contract>
<forrest:contract name="content-include-html">
    <forrest:properties contract="content-include-html">
      <forrest:property name="content-include-html" 
nugget="get.nugget.include.html">
       <url>/rightbar.html</url>
      </forrest:property>
    </forrest:properties>
</forrest:contract>
  </forrest:hook>
  </forrest:hook>

(content-include sounds just what I need)

3. The html code required I transfered from rightnav.ssi into rightnav.html 
and put this file
into xdocs directory. I am hoping that the <url>/rightbar.html</url> is 
therefore correct.

4. Didn't see what else I would need to do, so did a 'forrest run' , did not 
show up.
    Also did a ForrestBot onto the web server, also does not show up.

So, this did not work, the question is, have I done something wrong, missed 
something out
or is there a different/better way to include content into the 'headlines' 
hook ?

Alternative I thought of would be to create a contract for it. Although I 
can see how to
create a contract, not sure again on the best way of approaching it. Maybe 
doing a similar
thing as including the body from say index.xml but using 
rightnavcontent.xml, use jx: ??

I am sure I am missing the obvious, a pointer would be great :)

(Re-reading the above, I see at least (at last ?)  I have suggestions, so 
must be learning something!)

P.S-

Creating an empty hook has the side effect of a self closing div - obviously 
inlvalid and messes
up the rest of the page.

e.g.

<forrest:hook name="headlines"></forrest:hook>
creates
<div id="headlines />
instead of
<div id="headlines"></div>

Gav...



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006



Re: [zone] httpd configuration (was character entities)

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> David Crossley escribi??: 
> > Thorsten Scherler wrote:
> > > David Crossley escribi??:
> > > > 
> > > > No need to have them all in SVN, just the one that
> > > > we want to change.
> > > > 
> > > > I see that Cocoon put all their config into the
> > > > pmc/cocoon section of the private committers svn.
> > > 
> > > Hmm, and how are they doing the checkout?
> > 
> > At the moment it is actually the other way around.
> > They maintain the files on the server, and a tar-it-up.sh
> > to gather the important files, then a committer unpacks
> > and adds it to svn. A temporary measure.
> 
> Hmm, yeah a route that we should not go.

However it might make sense for these few
secret files, to get around the problem that
you describe below.

> > > I thought the private stuff is
> > > with password and we cannot checkout stuff with a user on zones.
> > 
> > As long as the user is in the right group
> > it will be fine. And as long as each user sets
> > their umask properly.
> 
> Hmm, you know that svn stores the password in a file? This means at
> least sudo can look up all passwords if she wants.

I see what you mean. However our committers
are trusted and people only get sudo if they
need it. Still you are right.

I wonder how other projects do it.
Perhaps a question for infra@.

Actually all the svn checkouts that i have
done on the zone are anonymous checkouts,
i.e. http and not https, so no password.
However, that will not work for our section
of the committers repository.

> I thought that was
> the reason why we could not set up a forrestbot on zones that is
> actually as well deploying to our website. ???

Not really. The reason is that we cannot
use a role-based account to do svn checkin.
i.e. imagine that we wanted to have a special
user called 'fb' and use that to run forrestbot
and do 'svn ci'. We cannot because 'fb' is not
a committer and so has no credentials.

> > That module is private to "committers" so that
> > should be okay.
> 
> Yeah, still the password is stored on the server.
> 
> > > > We should do the same for sensitive files like httpd.conf
> > > > 
> > > > The main stuff would stay in our forrest/zones svn,
> > > > because that is not sensitive and is of use to
> > > > other people.
> > > 
> > > Agree but I am not sure how you thought about it.
> > 
> > Neither am i.
> 
> ;-)
> 
> > > > > > Either way, we will need a document to remind us of all about
> > > > > > these specific symlinks and 'svn co'. I started something at
> > > > > > f.a.o/zone.html
> > > > > 
> > > > > I have not checked it in yet because we should decide first whether we
> > > > > want to have /etc/apache2/ in our svn or only /etc/apache2/httpd.conf.
> > > > > 
> > > > > I added it for now directly to /etc/apache2/httpd.conf and started the
> > > > > server (which had been down).
> > > > 
> > > > Glad that more people can now start the services.
> > > > We need to listen to infra@ and realise it is down.
> > > 
> > > Actually I submitted a patch to infrastructure to monitor lenya.zones
> > > with http://monitoring.apache.org/status/
> > > 
> > > http://issues.apache.org/jira/browse/INFRA-698
> > > 
> > > If we want, I can do the same for forrest, then we know when it is down
> > > and can react.
> > 
> > Our http server should only be down if the whole
> > zones machine has been rebooted. So IMO no need
> > for monitoring.
> 
> I have set up (again) a lenya instance on
> http://lenya.zones.apache.org/index.html for us a while ago. I have not
> told anyone till now because I hoped that my infra patch will be applied
> and we could monitor the server right away. I did some testing with up
> times and it seems to be fine this time.
> http://lenya.zones.apache.org:9000/
>
> But actually I would like to propose to set up a lenya instance on *our*
> zones server (due to the fact that I am the only one in lenya ATM that
> is looking out for the zone, it does not make any different to me to
> support it directly here). I am keen that we slowly playing around with
> lenya as cms and that we are independent from the lenya zone.

Better propose that in a separate thread.
Sounds like a good idea. That way other Forrest
committers can help.

> Further I would like to see as well a dynamic instance of forrest
> running on zone (I plan to start a web gui for dynamically altering
> structurer files) as show case.

We need to first make sure that forrest is
not a resource hog. This zone machine is shared
with other users, and we don't want to get
a bad name.

> > > > Next step is to automate the startup. See the fixme
> > > > note at http://forrest.apache.org/zone.html#admin
> > > 
> > > Yeah on lenya we seem to have it because you cannot stop the httpd
> > > without another one get up instantly. I will try to find the difference
> > > between both configs.
> > 
> > We don't have any config. As you can see we must start by
> > hand after a reboot.
> 
> I will try to set this up ASAP, since just today the server was down again (I started it again).

Okay, i presume that you mean 'smf'.

-David

Re: [zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El sáb, 28-01-2006 a las 22:17 +1100, David Crossley escribió: 
> Thorsten Scherler wrote:
> > David Crossley escribi??:
> > > 
> > > No need to have them all in SVN, just the one that
> > > we want to change.
> > > 
> > > I see that Cocoon put all their config into the
> > > pmc/cocoon section of the private committers svn.
> > 
> > Hmm, and how are they doing the checkout?
> 
> At the moment it is actually the other way around.
> They maintain the files on the server, and a tar-it-up.sh
> to gather the important files, then a committer unpacks
> and adds it to svn. A temporary measure.

Hmm, yeah a route that we should not go.

> 
> > I thought the private stuff is
> > with password and we cannot checkout stuff with a user on zones.
> 
> As long as the user is in the right group
> it will be fine. And as long as each user sets
> their umask properly.

Hmm, you know that svn stores the password in a file? This means at
least sudo can look up all passwords if she wants. I thought that was
the reason why we could not set up a forrestbot on zones that is
actually as well deploying to our website. ¿?

> 
> That module is private to "committers" so that
> should be okay.

Yeah, still the password is stored on the server.

> 
> > > We should do the same for sensitive files like httpd.conf
> > > 
> > > The main stuff would stay in our forrest/zones svn,
> > > because that is not sensitive and is of use to
> > > other people.
> > 
> > Agree but I am not sure how you thought about it.
> 
> Neither am i.

;-)

> 
> > > > > Either way, we will need a document to remind us of all about
> > > > > these specific symlinks and 'svn co'. I started something at
> > > > > f.a.o/zone.html
> > > > 
> > > > I have not checked it in yet because we should decide first whether we
> > > > want to have /etc/apache2/ in our svn or only /etc/apache2/httpd.conf.
> > > > 
> > > > I added it for now directly to /etc/apache2/httpd.conf and started the
> > > > server (which had been down).
> > > 
> > > Glad that more people can now start the services.
> > > We need to listen to infra@ and realise it is down.
> > 
> > Actually I submitted a patch to infrastructure to monitor lenya.zones
> > with http://monitoring.apache.org/status/
> > 
> > http://issues.apache.org/jira/browse/INFRA-698
> > 
> > If we want, I can do the same for forrest, then we know when it is down
> > and can react.
> 
> Our http server should only be down if the whole
> zones machine has been rebooted. So IMO no need
> for monitoring.

I have set up (again) a lenya instance on
http://lenya.zones.apache.org/index.html for us a while ago. I have not
told anyone till now because I hoped that my infra patch will be applied
and we could monitor the server right away. I did some testing with up
times and it seems to be fine this time.
http://lenya.zones.apache.org:9000/

But actually I would like to propose to set up a lenya instance on *our*
zones server (due to the fact that I am the only one in lenya ATM that
is looking out for the zone, it does not make any different to me to
support it directly here). I am keen that we slowly playing around with
lenya as cms and that we are independent from the lenya zone.

Further I would like to see as well a dynamic instance of forrest
running on zone (I plan to start a web gui for dynamically altering
structurer files) as show case.

> 
> > > Next step is to automate the startup. See the fixme
> > > note at http://forrest.apache.org/zone.html#admin
> > 
> > Yeah on lenya we seem to have it because you cannot stop the httpd
> > without another one get up instantly. I will try to find the difference
> > between both configs.
> 
> We don't have any config. As you can see we must start by
> hand after a reboot.
> 

I will try to set this up ASAP, since just today the server was down again (I started it again).

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [zone] httpd configuration (was character entities)

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> David Crossley escribi??:
> > 
> > No need to have them all in SVN, just the one that
> > we want to change.
> > 
> > I see that Cocoon put all their config into the
> > pmc/cocoon section of the private committers svn.
> 
> Hmm, and how are they doing the checkout?

At the moment it is actually the other way around.
They maintain the files on the server, and a tar-it-up.sh
to gather the important files, then a committer unpacks
and adds it to svn. A temporary measure.

> I thought the private stuff is
> with password and we cannot checkout stuff with a user on zones.

As long as the user is in the right group
it will be fine. And as long as each user sets
their umask properly.

That module is private to "committers" so that
should be okay.

> > We should do the same for sensitive files like httpd.conf
> > 
> > The main stuff would stay in our forrest/zones svn,
> > because that is not sensitive and is of use to
> > other people.
> 
> Agree but I am not sure how you thought about it.

Neither am i.

> > > > Either way, we will need a document to remind us of all about
> > > > these specific symlinks and 'svn co'. I started something at
> > > > f.a.o/zone.html
> > > 
> > > I have not checked it in yet because we should decide first whether we
> > > want to have /etc/apache2/ in our svn or only /etc/apache2/httpd.conf.
> > > 
> > > I added it for now directly to /etc/apache2/httpd.conf and started the
> > > server (which had been down).
> > 
> > Glad that more people can now start the services.
> > We need to listen to infra@ and realise it is down.
> 
> Actually I submitted a patch to infrastructure to monitor lenya.zones
> with http://monitoring.apache.org/status/
> 
> http://issues.apache.org/jira/browse/INFRA-698
> 
> If we want, I can do the same for forrest, then we know when it is down
> and can react.

Our http server should only be down if the whole
zones machine has been rebooted. So IMO no need
for monitoring.

> > Next step is to automate the startup. See the fixme
> > note at http://forrest.apache.org/zone.html#admin
> 
> Yeah on lenya we seem to have it because you cannot stop the httpd
> without another one get up instantly. I will try to find the difference
> between both configs.

We don't have any config. As you can see we must start by
hand after a reboot.

-David

Re: [zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El sáb, 28-01-2006 a las 17:04 +1100, David Crossley escribió:
> Thorsten Scherler wrote:
> > David Crossley escribi??:
> > > Thorsten Scherler wrote:
> > > > David Crossley escribi??:
> > ...
> > > > > At some stage we also need that httpd.conf to be in
> > > > > our forrest/zones SVN.
> > > > 
> > > > Will add our http.conf into the zone svn and symlink to it.
> > > 
> > > Perhaps better to have direct svn checkout, but not sure if that
> > > is possible for this httpd config.
> > 
> > Hmm, actually it would but only sudos could update then.
> 
> That is how it should be.
> 
> > ...and do we really want all the following files in svn (seeing by the
> > public)?
> > # ls -al /etc/apache2/
> > total 340
> > drwxr-xr-x   2 root     bin          512 Dec 15 01:07 .
> > drwxr-xr-x  65 root     sys         3584 Jan 26 05:26 ..
> > -rw-r--r--   1 root     bin         1987 May 16  2005
> > highperformance-std.conf
> > -rw-r--r--   1 root     bin         1987 May 16  2005
> > highperformance.conf
> > -rw-r--r--   1 root     bin        37519 May 16  2005 httpd-std.conf
> > -rw-r--r--   1 root     root       37689 Jan 26 22:31 httpd.conf
> > -rw-r--r--   1 root     bin        37661 Jul 20  2005 httpd.conf-example
> > -rw-r--r--   1 root     bin        12959 May 16  2005 magic
> > -rw-r--r--   1 root     bin        15020 May 16  2005 mime.types
> > -rw-r--r--   1 root     bin        10759 May 16  2005 ssl-std.conf
> > -rw-r--r--   1 root     bin        10996 May 16  2005 ssl.conf
> 
> No need to have them all in SVN, just the one that
> we want to change.
> 
> I see that Cocoon put all their config into the
> pmc/cocoon section of the private committers svn.
> 

Hmm, and how are they doing the checkout? I thought the private stuff is
with password and we cannot checkout stuff with a user on zones.

> We should do the same for sensitive files like httpd.conf
> 
> The main stuff would stay in our forrest/zones svn,
> because that is not sensitive and is of use to
> other people.

Agree but I am not sure how you thought about it.


> 
> > > Either way, we will need a document to remind us of all about
> > > these specific symlinks and 'svn co'. I started something at
> > > f.a.o/zone.html
> > 
> > I have not checked it in yet because we should decide first whether we
> > want to have /etc/apache2/ in our svn or only /etc/apache2/httpd.conf.
> > 
> > I added it for now directly to /etc/apache2/httpd.conf and started the
> > server (which had been down).
> 
> Glad that more people can now start the services.
> We need to listen to infra@ and realise it is down.
> 

Actually I submitted a patch to infrastructure to monitor lenya.zones
with http://monitoring.apache.org/status/

http://issues.apache.org/jira/browse/INFRA-698

If we want, I can do the same for forrest, then we know when it is down
and can react.

> Next step is to automate the startup. See the fixme
> note at http://forrest.apache.org/zone.html#admin

Yeah on lenya we seem to have it because you cannot stop the httpd
without another one get up instantly. I will try to find the difference
between both configs.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [zone] httpd configuration (was character entities)

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> David Crossley escribi??:
> > Thorsten Scherler wrote:
> > > David Crossley escribi??:
> ...
> > > > At some stage we also need that httpd.conf to be in
> > > > our forrest/zones SVN.
> > > 
> > > Will add our http.conf into the zone svn and symlink to it.
> > 
> > Perhaps better to have direct svn checkout, but not sure if that
> > is possible for this httpd config.
> 
> Hmm, actually it would but only sudos could update then.

That is how it should be.

> ...and do we really want all the following files in svn (seeing by the
> public)?
> # ls -al /etc/apache2/
> total 340
> drwxr-xr-x   2 root     bin          512 Dec 15 01:07 .
> drwxr-xr-x  65 root     sys         3584 Jan 26 05:26 ..
> -rw-r--r--   1 root     bin         1987 May 16  2005
> highperformance-std.conf
> -rw-r--r--   1 root     bin         1987 May 16  2005
> highperformance.conf
> -rw-r--r--   1 root     bin        37519 May 16  2005 httpd-std.conf
> -rw-r--r--   1 root     root       37689 Jan 26 22:31 httpd.conf
> -rw-r--r--   1 root     bin        37661 Jul 20  2005 httpd.conf-example
> -rw-r--r--   1 root     bin        12959 May 16  2005 magic
> -rw-r--r--   1 root     bin        15020 May 16  2005 mime.types
> -rw-r--r--   1 root     bin        10759 May 16  2005 ssl-std.conf
> -rw-r--r--   1 root     bin        10996 May 16  2005 ssl.conf

No need to have them all in SVN, just the one that
we want to change.

I see that Cocoon put all their config into the
pmc/cocoon section of the private committers svn.

We should do the same for sensitive files like httpd.conf

The main stuff would stay in our forrest/zones svn,
because that is not sensitive and is of use to
other people.

> > Either way, we will need a document to remind us of all about
> > these specific symlinks and 'svn co'. I started something at
> > f.a.o/zone.html
> 
> I have not checked it in yet because we should decide first whether we
> want to have /etc/apache2/ in our svn or only /etc/apache2/httpd.conf.
> 
> I added it for now directly to /etc/apache2/httpd.conf and started the
> server (which had been down).

Glad that more people can now start the services.
We need to listen to infra@ and realise it is down.

Next step is to automate the startup. See the fixme
note at http://forrest.apache.org/zone.html#admin

-David

Re: [zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El jue, 26-01-2006 a las 12:17 +1100, David Crossley escribió:
> Thorsten Scherler wrote:
> > David Crossley escribi??:
...
> > > At some stage we also need that httpd.conf to be in
> > > our forrest/zones SVN.
> > 
> > Will add our http.conf into the zone svn and symlink to it.
> 
> Perhaps better to have direct svn checkout, but not sure if that
> is possible for this httpd config.

Hmm, actually it would but only sudos could update then.

...and do we really want all the following files in svn (seeing by the
public)?
# ls -al /etc/apache2/
total 340
drwxr-xr-x   2 root     bin          512 Dec 15 01:07 .
drwxr-xr-x  65 root     sys         3584 Jan 26 05:26 ..
-rw-r--r--   1 root     bin         1987 May 16  2005
highperformance-std.conf
-rw-r--r--   1 root     bin         1987 May 16  2005
highperformance.conf
-rw-r--r--   1 root     bin        37519 May 16  2005 httpd-std.conf
-rw-r--r--   1 root     root       37689 Jan 26 22:31 httpd.conf
-rw-r--r--   1 root     bin        37661 Jul 20  2005 httpd.conf-example
-rw-r--r--   1 root     bin        12959 May 16  2005 magic
-rw-r--r--   1 root     bin        15020 May 16  2005 mime.types
-rw-r--r--   1 root     bin        10759 May 16  2005 ssl-std.conf
-rw-r--r--   1 root     bin        10996 May 16  2005 ssl.conf

> 
> Either way, we will need a document to remind us of all about
> these specific symlinks and 'svn co'. I started something at
> f.a.o/zone.html

I have not checked it in yet because we should decide first whether we
want to have /etc/apache2/ in our svn or only /etc/apache2/httpd.conf.

I added it for now directly to /etc/apache2/httpd.conf and started the
server (which had been down).

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [zone] httpd configuration (was character entities)

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> David Crossley escribi??:
> > Thorsten Scherler wrote:
> > > 
> > > Should I apply it as well for our zone? I did it only for Lenya atm and
> > > it works fine. :)
> > 
> > Yes please.
> > 
> > At some stage we also need that httpd.conf to be in
> > our forrest/zones SVN.
> 
> Will add our http.conf into the zone svn and symlink to it.

Perhaps better to have direct svn checkout, but not sure if that
is possible for this httpd config.

Either way, we will need a document to remind us of all about
these specific symlinks and 'svn co'. I started something at
f.a.o/zone.html

> Further I
> will apply above described patch as soon I can login. Right now I get:
> ssh: connect to host forrest.zones.apache.org port 22: Connection timed
> out

Yes, the machine "helios" is down:
http://www.apache.org/dev/#status

-David

Re: [zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El jue, 26-01-2006 a las 09:19 +1100, David Crossley escribió:
> Thorsten Scherler wrote:
> > 
> > sudo su
> > vi /etc/apache2/httpd.conf
> > find "Directory" and add the "" the part should look like:
> > 
> > # First, we configure the "default" to be a very restrictive set of
> > # features.
> > #
> > <Directory />
> >     Options FollowSymLinks
> >     AllowOverride None
> >     AddDefaultCharset UTF-8
> > </Directory>
> > 
> > That is better as stated in
> > http://httpd.apache.org/docs/2.2/howto/htaccess.html since 
> > "However, in general, use of .htaccess files should be avoided when
> > possible. Any configuration that you would consider putting in
> > a .htaccess file, can just as effectively be made in a <Directory>
> > section in your main server configuration file."
> > 
> > Should I apply it as well for our zone? I did it only for Lenya atm and
> > it works fine. :)
> 
> Yes please.
> 
> At some stage we also need that httpd.conf to be in
> our forrest/zones SVN.
> 

Will add our http.conf into the zone svn and symlink to it. Further I
will apply above described patch as soon I can login. Right now I get:
ssh: connect to host forrest.zones.apache.org port 22: Connection timed
out

salu2

> -David
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [zone] httpd configuration (was character entities)

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> 
> sudo su
> vi /etc/apache2/httpd.conf
> find "Directory" and add the "" the part should look like:
> 
> # First, we configure the "default" to be a very restrictive set of
> # features.
> #
> <Directory />
>     Options FollowSymLinks
>     AllowOverride None
>     AddDefaultCharset UTF-8
> </Directory>
> 
> That is better as stated in
> http://httpd.apache.org/docs/2.2/howto/htaccess.html since 
> "However, in general, use of .htaccess files should be avoided when
> possible. Any configuration that you would consider putting in
> a .htaccess file, can just as effectively be made in a <Directory>
> section in your main server configuration file."
> 
> Should I apply it as well for our zone? I did it only for Lenya atm and
> it works fine. :)

Yes please.

At some stage we also need that httpd.conf to be in
our forrest/zones SVN.

-David

Re: [zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El mar, 24-01-2006 a las 23:43 +0100, Thorsten Scherler escribió:
> El mié, 25-01-2006 a las 09:23 +1100, David Crossley escribió:
> > Thorsten Scherler wrote:
> > > David Crossley escribi??:
> > > > 
> > > > On forrest.apache.org we have this workaround in our .htaccess
> > > > AddDefaultCharset UTF-8
> > > > 
> > > > However we don't yet have that on forrest.zones.apache.org as
> > > > our httpd instance needs other configuration too.
> > > 
> > > Yeah, I tried the .htaccess tip but like you stated there are some other
> > > configurations to do. 
> > > 
> > > Do you know which or maybe can point me to some resources?
> > 
> > http://httpd.apache.org/docs/2.2/
> > 
> > Need to enable the use of .htaccess files.
> > 
> 
> Thx, will have a look.
> 

sudo su
vi /etc/apache2/httpd.conf
find "Directory" and add the "" the part should look like:

# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    AddDefaultCharset UTF-8
</Directory>

That is better as stated in
http://httpd.apache.org/docs/2.2/howto/htaccess.html since 
"However, in general, use of .htaccess files should be avoided when
possible. Any configuration that you would consider putting in
a .htaccess file, can just as effectively be made in a <Directory>
section in your main server configuration file."

Should I apply it as well for our zone? I did it only for Lenya atm and
it works fine. :)

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El mié, 25-01-2006 a las 09:23 +1100, David Crossley escribió:
> Thorsten Scherler wrote:
> > David Crossley escribi??:
> > > 
> > > On forrest.apache.org we have this workaround in our .htaccess
> > > AddDefaultCharset UTF-8
> > > 
> > > However we don't yet have that on forrest.zones.apache.org as
> > > our httpd instance needs other configuration too.
> > 
> > Yeah, I tried the .htaccess tip but like you stated there are some other
> > configurations to do. 
> > 
> > Do you know which or maybe can point me to some resources?
> 
> http://httpd.apache.org/docs/2.2/
> 
> Need to enable the use of .htaccess files.
> 

Thx, will have a look.

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: [zone] httpd configuration (was character entities)

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
> David Crossley escribi??:
> > 
> > On forrest.apache.org we have this workaround in our .htaccess
> > AddDefaultCharset UTF-8
> > 
> > However we don't yet have that on forrest.zones.apache.org as
> > our httpd instance needs other configuration too.
> 
> Yeah, I tried the .htaccess tip but like you stated there are some other
> configurations to do. 
> 
> Do you know which or maybe can point me to some resources?

http://httpd.apache.org/docs/2.2/

Need to enable the use of .htaccess files.

-David

[zone] httpd configuration (was character entities)

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 23-01-2006 a las 11:43 +1100, David Crossley escribió:
> Thorsten Scherler wrote:
> >
> > Yeah, I am running into the same problem ATM. You can see it online at 
> > http://lenya.zones.apache.org/ "Today:??..." (I am looking right now to
> > fix that, so the site may be fixed if you visit it)
> > 
> > On my local machine that does not happen. I have run into a similar
> > problem with cocoon on a job I did a while ago. The problem was lying in
> > the server configuration, now I just looked on our zones server:
> > Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
> > -bash-3.00$ locale
> > LANG=
> > LC_CTYPE="C"
> > LC_NUMERIC="C"
> > LC_TIME="C"
> > LC_COLLATE="C"
> > LC_MONETARY="C"
> > LC_MESSAGES="C"
> > LC_ALL=
> > 
> > The locale is not UTF-8!
> > 
> > Doing "locale" on my machine gives:
> > LANG=es_ES.UTF-8
> > LC_CTYPE="es_ES.UTF-8"
> > LC_NUMERIC="es_ES.UTF-8"
> > LC_TIME="es_ES.UTF-8"
> > LC_COLLATE="es_ES.UTF-8"
> > LC_MONETARY="es_ES.UTF-8"
> > LC_MESSAGES="es_ES.UTF-8"
> > LC_PAPER="es_ES.UTF-8"
> > LC_NAME="es_ES.UTF-8"
> > LC_ADDRESS="es_ES.UTF-8"
> > LC_TELEPHONE="es_ES.UTF-8"
> > LC_MEASUREMENT="es_ES.UTF-8"
> > LC_IDENTIFICATION="es_ES.UTF-8"
> > LC_ALL=
> > 
> > That is UTF-8!
> > 
> > The solution back on the job was setting the language to de_DE.UTF-8
> > before starting the tomcat server.
> > 

I tried this but the httpd on zone is started differently like on other
unix systems. I am still looking for a way how to "teach apache2" to use
utf-8 locales. 

Finding
http://marc.theaimsgroup.com/?t=113761190300004&r=1&w=2

makes it clear that even if you set the env to utf-8 prior to the start
of httpd it will get ignored. :(

> > >
...
> > 
> > Actually regarding http://www.html-world.de/program/html_sz.php 
> > Unicode: &nbsp;
> > XML: &#160;
> > Result: space
> > 
> > We are using the right code for spaces. I guess you need to set the
> > locale to UTF-8 on the server (before starting httpd), since forrest is
> > rendering it on lenya.zones just fine but the httpd is delivering the
> > content with "??".
> 
> On forrest.apache.org we have this workaround in our .htaccess
> AddDefaultCharset UTF-8
> 
> However we don't yet have that on forrest.zones.apache.org as
> our httpd instance needs other configuration too.

Yeah, I tried the .htaccess tip but like you stated there are some other
configurations to do. 

Do you know which or maybe can point me to some resources?

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: character entities

Posted by David Crossley <cr...@apache.org>.
Thorsten Scherler wrote:
>
> Yeah, I am running into the same problem ATM. You can see it online at 
> http://lenya.zones.apache.org/ "Today:??..." (I am looking right now to
> fix that, so the site may be fixed if you visit it)
> 
> On my local machine that does not happen. I have run into a similar
> problem with cocoon on a job I did a while ago. The problem was lying in
> the server configuration, now I just looked on our zones server:
> Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
> -bash-3.00$ locale
> LANG=
> LC_CTYPE="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_COLLATE="C"
> LC_MONETARY="C"
> LC_MESSAGES="C"
> LC_ALL=
> 
> The locale is not UTF-8!
> 
> Doing "locale" on my machine gives:
> LANG=es_ES.UTF-8
> LC_CTYPE="es_ES.UTF-8"
> LC_NUMERIC="es_ES.UTF-8"
> LC_TIME="es_ES.UTF-8"
> LC_COLLATE="es_ES.UTF-8"
> LC_MONETARY="es_ES.UTF-8"
> LC_MESSAGES="es_ES.UTF-8"
> LC_PAPER="es_ES.UTF-8"
> LC_NAME="es_ES.UTF-8"
> LC_ADDRESS="es_ES.UTF-8"
> LC_TELEPHONE="es_ES.UTF-8"
> LC_MEASUREMENT="es_ES.UTF-8"
> LC_IDENTIFICATION="es_ES.UTF-8"
> LC_ALL=
> 
> That is UTF-8!
> 
> The solution back on the job was setting the language to de_DE.UTF-8
> before starting the tomcat server.
> 
> > I am seeing ?? a lot lately and so think the problem is still not solved.
> 
> Yeah, we need to find the root cause of this problem. I guess it is
> lying in the "locale".
> 
> > For instance it is the result of siteinfo-last-published.ft.
> > 
> > Last Published:?? 01/21/2006 17:53:37
> > 
> > This line is created from the contract here :-
> > 
> > <xsl:template name="siteinfo-last-published-body">
> >         <script type="text/javascript">document.write("<i18n:text >Last 
> > Published:</i18n:text>&#160;" + document.lastModified);</script>
> >       </xsl:template>
> > 
> > I have a theory.
> > 
> > in the code the &#160; is right next to a " (quote). The entity number for " 
> > (quote) is &#34;
> > 
> > I had a crazy thought that maybe they were adding together somehow. 
> > (160+34=194)
> > 
> > &#160; + &#34; = &#194;
> > 
> > Guess what &#194; is equal to , yup :-
> > 
> > ??
> 
> Jeje, nice theory, but I have an example where you do not combine &#160;
> with " and still the described behavior can be seen.
> 
>         <forrest:hook class="breadtrail">
>           <forrest:contract name="genericMarkup">
>             <forrest:properties contract="genericMarkup">
>               <forrest:property name="genericMarkup">
>                 <strong>&#160;</strong>
>               </forrest:property>
>             </forrest:properties>
>           </forrest:contract>
>         </forrest:hook>
> 
> 
> > 
> > Anyway, in the example contract code above, removing &#160; and putting a 
> > real space in there cures it and the space
> > is preserved no problem as it is enclosed between the quotes.
> > 
> > I copied the contract to my /pili/html/ directory and it now renders 
> > correctly.
> > 
> > Have I missed something here or was it that simple ?
> > 
> 
> Actually regarding http://www.html-world.de/program/html_sz.php 
> Unicode: &nbsp;
> XML: &#160;
> Result: space
> 
> We are using the right code for spaces. I guess you need to set the
> locale to UTF-8 on the server (before starting httpd), since forrest is
> rendering it on lenya.zones just fine but the httpd is delivering the
> content with "??".

On forrest.apache.org we have this workaround in our .htaccess
AddDefaultCharset UTF-8

However we don't yet have that on forrest.zones.apache.org as
our httpd instance needs other configuration too.

-David

> More information about utf-8 and unicode can be found on [1]. How to set
> it in Gentoo [2] is in spanish only but I reckon you still can get the
> idea following the coding examples. Finally [3] a smaller howto in
> english.
> 
> HTH
> salu2
> 
> [1]http://www.cl.cam.ac.uk/~mgk25/unicode.html
> [2]http://es.gentoo-wiki.com/Unicode-UTF-8
> [3]http://www.linux.com/howtos/Indic-Fonts-HOWTO/locale.shtml
> -- 
> thorsten
> 
> "Together we stand, divided we fall!" 
> Hey you (Pink Floyd)
> 

Re: Best way to add repeatable code in v2/v3 (was Re: Example usecase)

Posted by Thorsten Scherler <th...@apache.org>.
El lun, 30-01-2006 a las 16:06 +0800, Gav.... escribió:

...
> 
> As soon as you change it on a regular basis and
> | would need to have different code on different pages it makes sense to
> |
> | 2) create a custom business service
> | A custom business service is an extension of forrest core data models.
> | In the dataModel.xmap you can find the core models. You can add your own
> | service to your project sitemap. Like:
> | <map:match pattern="includes.rightbar.**.xml">
> | <map:generate src="{project:resources}/includes/rightbar/{1}.xml" />
> | <map:serialize type="xml"/>
> | </map:match>
> |
> | This assumes that you move to xml instead of html output (remember you
> | can use html like grammar in xml).
> |
> | Now you could define the contract like:
> | <forrest:contract name="content-include-rightbar">
> |    <forrest:properties contract="content-include-rightbar">
> |      <forrest:property name="content-include-rightbar"
> | nugget="get.nugget.include.rightbar">
> |        <jx:import
> | uri="cocoon://includes.rightbar.#{$cocoon/parameters/getRequest}.xml"/>
> |      </forrest:property>
> |    </forrest:properties>
> | </forrest:contract>
> |
> | and the contract:
> |      <xsl:template name="content-include-rightbar-body" >
> |        <xsl:param name="content-include-rightbar"/>
> |        <xsl:copy-of
> |          select="$content-include-rightbar/*"/>
> |      </xsl:template>
> 
> I have been looking at this only in them email and not tried yet
> to implement it. I just can not see at the moment how to use this
> to apply slightly varying content to different pages.
> 
> For instance, look at the right hand side of
> http://www.minitutorials.com/apache/apacheindex.shtml.
> 
> There is a 'This page sponsored by' div and then below it is another
> div with the sponsor image and info. This div is the only div that will be
> different on all pages. Everything else on the right hand side will be
> exactly the same for the whole site.

So then you have to split the stuff that changes apart from the static
content.

> 
> So this custom business service 'sounds' like what I need, just I can't
> see how to implement it.

Ok, to find out:
Do your sponsored pages follow some rule? I mean on page xy there is
always sponsor z, or a similar rule. Or are this sponsor link
dynamically and will change even after a refresh of the site?

> 
> Does anyone have any ideas on the how ?

Actually it is all a little bit further on the top. 

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: Best way to add repeatable code in v2/v3 (was Re: Example usecase)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@apache.org>
To: <de...@forrest.apache.org>
Sent: Monday, January 23, 2006 1:19 AM
Subject: Re: Best way to add repeatable code in v2/v3 (was Re: Example 
usecase)


<snip>

|
| <forrest:contract name="content-include-html">
|    <forrest:properties contract="content-include-html">
|      <forrest:property name="content-include-html"
| nugget="get.nugget.include.html">
|        <jx:import uri="cocoon://includes.rightbar.html"/>
|      </forrest:property>
|    </forrest:properties>
| </forrest:contract>
|
| ...but be aware that this contract expect a <div id="content"/>:
| <xsl:copy-of select="$content-include-html//div[@id='content']/*"/>

As I said in another mail, I could not get this to work, but doesn't
matter now anyway, thought I'd mention it in case the problem
was was also a sympton for something else.

|
| > Alternative I thought of would be to create a contract for it. Although 
I
| > can see how to
| > create a contract, not sure again on the best way of approaching it. 
Maybe
| > doing a similar
| > thing as including the body from say index.xml but using
| > rightnavcontent.xml, use jx: ??
| >
|
| Actually I think in your case it would makes sense to create a contract.
|
| Now you have different options to implement it.
|
| 1) controlled by the structurer
| You can use the genericMarkup.ft
| <forrest:contract name="genericMarkup">
| <forrest:properties contract="genericMarkup">
|  <forrest:property name="genericMarkup">
|   <div class="rightsub">
|    <h5>Sponsor This Site!</h5>
|   </div>
|  </forrest:property>
| </forrest:properties>
| </forrest:contract>
|
| You would do this if the code is added to all pages and actually does
| not change too much.

I have done this and works fine, http://apache.minitutorials.com/ is 
updated.

As soon as you change it on a regular basis and
| would need to have different code on different pages it makes sense to
|
| 2) create a custom business service
| A custom business service is an extension of forrest core data models.
| In the dataModel.xmap you can find the core models. You can add your own
| service to your project sitemap. Like:
| <map:match pattern="includes.rightbar.**.xml">
| <map:generate src="{project:resources}/includes/rightbar/{1}.xml" />
| <map:serialize type="xml"/>
| </map:match>
|
| This assumes that you move to xml instead of html output (remember you
| can use html like grammar in xml).
|
| Now you could define the contract like:
| <forrest:contract name="content-include-rightbar">
|    <forrest:properties contract="content-include-rightbar">
|      <forrest:property name="content-include-rightbar"
| nugget="get.nugget.include.rightbar">
|        <jx:import
| uri="cocoon://includes.rightbar.#{$cocoon/parameters/getRequest}.xml"/>
|      </forrest:property>
|    </forrest:properties>
| </forrest:contract>
|
| and the contract:
|      <xsl:template name="content-include-rightbar-body" >
|        <xsl:param name="content-include-rightbar"/>
|        <xsl:copy-of
|          select="$content-include-rightbar/*"/>
|      </xsl:template>

I have been looking at this only in them email and not tried yet
to implement it. I just can not see at the moment how to use this
to apply slightly varying content to different pages.

For instance, look at the right hand side of
http://www.minitutorials.com/apache/apacheindex.shtml.

There is a 'This page sponsored by' div and then below it is another
div with the sponsor image and info. This div is the only div that will be
different on all pages. Everything else on the right hand side will be
exactly the same for the whole site.

So this custom business service 'sounds' like what I need, just I can't
see how to implement it.

Does anyone have any ideas on the how ?

Thorsten, I know you have a real work-load on, so just say 'too busy'
if you like and I'll look a bit deeper into it myself.

Thanks

Gav...

| HTH
| salu2
| -- 
| thorsten
|
| "Together we stand, divided we fall!"
| Hey you (Pink Floyd)
|
|
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 
20/01/2006
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 27/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re: Example usecase)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@apache.org>
To: <de...@forrest.apache.org>
Sent: Monday, January 23, 2006 1:19 AM
Subject: Re: Best way to add repeatable code in v2/v3 (was Re: Example 
usecase)

<snip>

| >
| > 2. Then I looked through ls.contracts and found one I thought might be
| > suitable as replacement of 'include/require'
| > Adding the code for it into my hooks above I ended up with :-
| >
| >  <forrest:hook name="headlines">
| >    <forrest:hook name="rightbar">
| >      <forrest:contract name="search-input">
| >             <forrest:properties contract="search-input">
| >               <forrest:property name="search-input">
| >                 <search name="minitutorials" 
domain="www.minitutorials.com"
| > provider="google"/>
| >               </forrest:property>
| >             </forrest:properties>
| >     </forrest:contract>
| > <forrest:contract name="content-include-html">
| >     <forrest:properties contract="content-include-html">
| >       <forrest:property name="content-include-html"
| > nugget="get.nugget.include.html">
| >        <url>/rightbar.html</url>
| >       </forrest:property>
| >     </forrest:properties>
| > </forrest:contract>
| >   </forrest:hook>
| >   </forrest:hook>
| >
| > (content-include sounds just what I need)
|
| Hmm, not directly.
| 1) it is a v1 contract. <url>/rightbar.html</url> is not aviable
| anymore. This have to be done with jx:import.
| 2) the syntax you use expects rightbar.html *not* in the docroot but the
| the file path /rightbar.html!
|
| >
| > 3. The html code required I transfered from rightnav.ssi into 
rightnav.html
| > and put this file
| > into xdocs directory. I am hoping that the <url>/rightbar.html</url> is
| > therefore correct.
|
| no, see above
|
| >
| > 4. Didn't see what else I would need to do, so did a 'forrest run' , did 
not
| > show up.
| >     Also did a ForrestBot onto the web server, also does not show up.
| >
| > So, this did not work, the question is, have I done something wrong, 
missed
| > something out
| > or is there a different/better way to include content into the 
'headlines'
| > hook ?
| >
|
| <forrest:contract name="content-include-html">
|    <forrest:properties contract="content-include-html">
|      <forrest:property name="content-include-html"
| nugget="get.nugget.include.html">
|        <jx:import uri="cocoon://includes.rightbar.html"/>
|      </forrest:property>
|    </forrest:properties>
| </forrest:contract>
|
| ...but be aware that this contract expect a <div id="content"/>:
| <xsl:copy-of select="$content-include-html//div[@id='content']/*"/>

Ouch!, It didn't like like one bit. I added the above contract into pili.fv.
I then wrapped the entire rightbar.html code into the required <div 
id="content"> ...</div>
(After testing I was going to alter the contract so I wouldnt need to do 
this)

Forrest Run
http://localhost:8888

(wait 10 minutes, computer slows to a crawl.)

Page can not be displayed ..

errors from jetty, inlcude:

popContextNodeList when stack is empty!
Logging Error: Unknown error writing event.
java.lang.OutOfMemoryError: Java Heap Space.

Above 3 lines repeated forever.

I then remove content-include-html contract from pili.fv
Refresh browser, all works fine again.

Will try again. Just to confirm 'rightbar.html' is in /xdocs/

|
| > Alternative I thought of would be to create a contract for it. Although 
I
| > can see how to
| > create a contract, not sure again on the best way of approaching it. 
Maybe
| > doing a similar
| > thing as including the body from say index.xml but using
| > rightnavcontent.xml, use jx: ??
| >
|
| Actually I think in your case it would makes sense to create a contract.
|
| Now you have different options to implement it.
|
| 1) controlled by the structurer
| You can use the genericMarkup.ft
| <forrest:contract name="genericMarkup">
| <forrest:properties contract="genericMarkup">
|  <forrest:property name="genericMarkup">
|   <div class="rightsub">
|    <h5>Sponsor This Site!</h5>
|   </div>
|  </forrest:property>
| </forrest:properties>
| </forrest:contract>
|
| You would do this if the code is added to all pages and actually does
| not change too much.

90% of the code would be on all pages. It is mainly a site news type of
area and so would change infrequently, maybe once a month or two months.

The other '10%' is geared to a sponsor ad, one sponsor per page and an
overall site sponsor, so this part would be different on all pages.

|As soon as you change it on a regular basis and
| would need to have different code on different pages it makes sense to
|
| 2) create a custom business service
| A custom business service is an extension of forrest core data models.
| In the dataModel.xmap you can find the core models. You can add your own
| service to your project sitemap. Like:
| <map:match pattern="includes.rightbar.**.xml">
| <map:generate src="{project:resources}/includes/rightbar/{1}.xml" />
| <map:serialize type="xml"/>
| </map:match>
|
| This assumes that you move to xml instead of html output (remember you
| can use html like grammar in xml).
|
| Now you could define the contract like:
| <forrest:contract name="content-include-rightbar">
|    <forrest:properties contract="content-include-rightbar">
|      <forrest:property name="content-include-rightbar"
| nugget="get.nugget.include.rightbar">
|        <jx:import
| uri="cocoon://includes.rightbar.#{$cocoon/parameters/getRequest}.xml"/>
|      </forrest:property>
|    </forrest:properties>
| </forrest:contract>
|
| and the contract:
|      <xsl:template name="content-include-rightbar-body" >
|        <xsl:param name="content-include-rightbar"/>
|        <xsl:copy-of
|          select="$content-include-rightbar/*"/>
|      </xsl:template>

Ok, this sounds to be the best way to go, but I can not see how to implement 
it as
the 10% is different on all pages. (I created different inlcudes currently)

| 3) ...
|
| I can actually think on a couple of other ways how to include extra stuff 
but it always depend on the usecase.
| Questions like:
| - is the content request aware?

Not at the moment, in the future I'll probably add back in a bit of PHP, but 
not yet
I'll get it working without first.

| - does it makes sense to create a custom business service?

Not sure. It seems to me Im stuck between this and the genericMarkup.ft. ??

| - will the content included and actually never changed?

It will change infrequently.

| - do you need a contract that you can reuse in different projects?

No

| - how generic the contract has to be?

90% :-)

Gav...

| ....
|
| HTH
| salu2
| -- 
| thorsten
|
| "Together we stand, divided we fall!"
| Hey you (Pink Floyd)
|
|
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 
20/01/2006
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/240 - Release Date: 25/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re: Example use case)

Posted by Thorsten Scherler <th...@apache.org>.
El sáb, 21-01-2006 a las 20:06 +0800, Gav.... escribió: 
> Hi All,
> 
> On the right hand side of http://minitutorials.com I have some 'headlines' 
> in a 'headlines' div
> All boxes are in a 'rightbar' div also.
> The code for this is in One file called rightnav.ssi and included using 
> either 'include' or 'require'
> This obviously has the effect that all of the site pages get the content 
> from the one file.
> 
> I have been looking at how to do this using dispatcher method.
> 
> What I have tried :-
> 
> 1. Create Hooks as required to get the div and css to position it.
> 
>  <forrest:hook name="headlines">
>    <forrest:hook name="rightbar">
>      <forrest:contract name="search-input">
>             <forrest:properties contract="search-input">
>               <forrest:property name="search-input">
>                 <search name="minitutorials" domain="www.minitutorials.com" 
> provider="google"/>
>               </forrest:property>
>             </forrest:properties>
>     </forrest:contract>
>   </forrest:hook>
>   </forrest:hook>
> 
> As you can see I have added a search-input so the div shows on the site and 
> is present at http://apache.minitutorials.com

yeah, nice.

> 
> 2. Then I looked through ls.contracts and found one I thought might be 
> suitable as replacement of 'include/require'
> Adding the code for it into my hooks above I ended up with :-
> 
>  <forrest:hook name="headlines">
>    <forrest:hook name="rightbar">
>      <forrest:contract name="search-input">
>             <forrest:properties contract="search-input">
>               <forrest:property name="search-input">
>                 <search name="minitutorials" domain="www.minitutorials.com" 
> provider="google"/>
>               </forrest:property>
>             </forrest:properties>
>     </forrest:contract>
> <forrest:contract name="content-include-html">
>     <forrest:properties contract="content-include-html">
>       <forrest:property name="content-include-html" 
> nugget="get.nugget.include.html">
>        <url>/rightbar.html</url>
>       </forrest:property>
>     </forrest:properties>
> </forrest:contract>
>   </forrest:hook>
>   </forrest:hook>
> 
> (content-include sounds just what I need)

Hmm, not directly. 
1) it is a v1 contract. <url>/rightbar.html</url> is not aviable
anymore. This have to be done with jx:import.
2) the syntax you use expects rightbar.html *not* in the docroot but the
the file path /rightbar.html!

> 
> 3. The html code required I transfered from rightnav.ssi into rightnav.html 
> and put this file
> into xdocs directory. I am hoping that the <url>/rightbar.html</url> is 
> therefore correct.

no, see above

> 
> 4. Didn't see what else I would need to do, so did a 'forrest run' , did not 
> show up.
>     Also did a ForrestBot onto the web server, also does not show up.
> 
> So, this did not work, the question is, have I done something wrong, missed 
> something out
> or is there a different/better way to include content into the 'headlines' 
> hook ?
> 

<forrest:contract name="content-include-html">
    <forrest:properties contract="content-include-html">
      <forrest:property name="content-include-html"
nugget="get.nugget.include.html">
        <jx:import uri="cocoon://includes.rightbar.html"/>
      </forrest:property>
    </forrest:properties>
</forrest:contract>

...but be aware that this contract expect a <div id="content"/>:
<xsl:copy-of select="$content-include-html//div[@id='content']/*"/>

> Alternative I thought of would be to create a contract for it. Although I 
> can see how to
> create a contract, not sure again on the best way of approaching it. Maybe 
> doing a similar
> thing as including the body from say index.xml but using 
> rightnavcontent.xml, use jx: ??
> 

Actually I think in your case it would makes sense to create a contract.

Now you have different options to implement it. 

1) controlled by the structurer 
You can use the genericMarkup.ft
<forrest:contract name="genericMarkup">
 <forrest:properties contract="genericMarkup">
  <forrest:property name="genericMarkup">
   <div class="rightsub">
    <h5>Sponsor This Site!</h5>
   </div>
  </forrest:property>
 </forrest:properties>
</forrest:contract>

You would do this if the code is added to all pages and actually does
not change too much. As soon as you change it on a regular basis and
would need to have different code on different pages it makes sense to

2) create a custom business service
A custom business service is an extension of forrest core data models.
In the dataModel.xmap you can find the core models. You can add your own
service to your project sitemap. Like:
<map:match pattern="includes.rightbar.**.xml">
 <map:generate src="{project:resources}/includes/rightbar/{1}.xml" />
 <map:serialize type="xml"/>
</map:match>

This assumes that you move to xml instead of html output (remember you
can use html like grammar in xml).

Now you could define the contract like:
<forrest:contract name="content-include-rightbar">
    <forrest:properties contract="content-include-rightbar">
      <forrest:property name="content-include-rightbar"
nugget="get.nugget.include.rightbar">
        <jx:import
uri="cocoon://includes.rightbar.#{$cocoon/parameters/getRequest}.xml"/>
      </forrest:property>
    </forrest:properties>
</forrest:contract>

and the contract:
      <xsl:template name="content-include-rightbar-body" >
        <xsl:param name="content-include-rightbar"/>
        <xsl:copy-of 
          select="$content-include-rightbar/*"/>
      </xsl:template>
3) ...

I can actually think on a couple of other ways how to include extra stuff but it always depend on the usecase.
Questions like:
- is the content request aware?
- does it makes sense to create a custom business service?
- will the content included and actually never changed?
- do you need a contract that you can reuse in different projects?
- how generic the contract has to be?
....

HTH
salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: Best way to add repeatable code in v2/v3 (was Re: Exampleusecase)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@apache.org>
To: <de...@forrest.apache.org>
Sent: Sunday, January 22, 2006 9:56 PM
Subject: Re: Best way to add repeatable code in v2/v3 (was Re: 
Exampleusecase)


| El dom, 22-01-2006 a las 21:38 +0800, Gav.... escribió:
| > ----- Original Message ----- 
| > From: "Thorsten Scherler" <th...@apache.org>
| > To: <de...@forrest.apache.org>
| > Sent: Sunday, January 22, 2006 9:26 PM
| > Subject: Re: Best way to add repeatable code in v2/v3 (was Re: Example
| > usecase)
| >
| >
| > | El dom, 22-01-2006 a las 21:09 +0800, Gav.... escribió:
| > | ...
| > | > |
| > | > | > P.S-
| > | > | >
| > | > | > Creating an empty hook has the side effect of a self closing 
div -
| > | > obviously
| > | > | > inlvalid and messes
| > | > | > up the rest of the page.
| > | > |
| > | > | Raise an issue (if there isn't one already, this is ringing a bell
| > | > | somewhere in the deep recesses of my mind).
| > | >
| > | > I will raise an issue, I had a good look for one but could not
| > | > find a relevent one.
| > |
| > | Hmm, did you read the other mail I wrote?
| >
| > Yes, I posted this earlier than that one arrived though.
| >
| > |
| > |
| > 
forrest-trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/hooksMatcher.xsl
| > | ...
| > | <xsl:if test="@nbsp='true'">&#160;</xsl:if>
| > | ...
| > |
| > | Meaning
| > | <forrest:hook name="headlines"></forrest:hook>
| > | creates
| > | <div id="headlines />
| > |
| > | and <forrest:hook name="headlines" nbsp="true"></forrest:hook>
| > | gives
| > | <div id="headlines"> </div>
| > |
| > | We need to document this in the howto, but self enclosing divs are
| > | default in the dispatcher, no bug!
| >
| > Thats fine, I will send in a patch to document this. I can not really
| > think of a situation (except in testing) where I would want an
| > empty div anyway, but came across it so mentioned it.
|
| Actually since Cyriaque and yourself seem to prefer that the default
| behavior would be non enclosing divs we can change the default
| behavior.
|
| wdyt?

Personally I think it wise to do so, especially if we are aiming to
adhere to W3C XHTML2 standards, where this is a must.
There are certain elements thsat can self close, <separator /> etc
but div is not one of them.

In the hooksMatcher.xsl, would you change true to false then?

Thanks

Gav...

|
| >
| > I did see the resolution you mention in the whiteboard and on list [1]
| > but wasn't sure of the final outcome.
| >
| > Thanks. Now if you could point me in the right direction regarding
| > the subject title ;>)
|
| jeje, yeah, after I fixed the httpd bug on lenya.zones.
|
| salu2
|
| >
| > [1] -
| > 
http://mail-archives.apache.org/mod_mbox/forrest-dev/200507.mbox/%3C42EA35BD.5080008@pcotech.fr%3E
| >
| > Gav...
| >
| > |
| > | salu2
| > | -- 
| > | thorsten
| > |
| > | "Together we stand, divided we fall!"
| > | Hey you (Pink Floyd)
| > |
| > |
| > |
| > |
| > | -- 
| > | No virus found in this incoming message.
| > | Checked by AVG Free Edition.
| > | Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date:
| > 20/01/2006
| > |
| > |
| >
| >
| >
| -- 
| thorsten
|
| "Together we stand, divided we fall!"
| Hey you (Pink Floyd)
|
|
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 
20/01/2006
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re:Exampleusecase)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@wyona.com>
To: <de...@forrest.apache.org>
Sent: Friday, January 27, 2006 8:24 PM
Subject: Re: Best way to add repeatable code in v2/v3 (was 
Re:Exampleusecase)


| El vie, 27-01-2006 a las 17:59 +0800, Gav.... escribió:
| > ----- Original Message ----- 
|
| ...
| > |
| > | Actually since Cyriaque and yourself seem to prefer that the default
| > | behavior would be non enclosing divs we can change the default
| > | behavior.
| > |
| > | wdyt?
| >
| > I have found another reason why it is best to close these divs properly.
| >
| > e.g.
| >
| >  <forrest:contract name="content-abstract">
| >             <forrest:properties contract="content-abstract">
| >               <forrest:property name="content-abstract"
| > nugget="get.abstract">
| >                 <jx:import
| > uri="cocoon://#{$cocoon/parameters/getRequest}.abstract.xml"/>
| >               </forrest:property>
| >             </forrest:properties>
| >  </forrest:contract>
| >
| > If there is content to return into this content-abstract request then 
that
| > is fine, on pages where there may not be any content available to 
return,
| > then the contract is blank. This creates a <div class="abstract" /> . It 
so
| > happens that most style sheets I looked at give the abstract div an 
'italic'
| > font-style. Because the div is not closed properly, the rest of the 
content
| > (content-main, content-minitoc-area etc.. ) that follows this 
self-closed
| > div are also outputting the 'italic' font-style.
| >
| > I looked for ages as to why my main content was italic, its because I 
have
| > no abtract-content in the xml source to give.
| >
| > I suppose one has to decide to either use a contract like this for all 
pages
| > or for none.
|
| Why not check whether there is an abstract and if not omit the div?
| <xsl:if test="$content-abstract/div[@class='abstract']/*">
| <xsl:copy-of
|          select="$content-abstract/div[@class='abstract']"/>
| </xsl:if>

You see, this is where I am still catching up with XSL, I didn't think
of solving it that way. Thanks. For the time being though, I moved
my abstract and am using it for something else at the moment. It might
be good to inlcude it somewhere as a commented out example.
Where should it go as an example ?

Gav...

|
| salu2
| -- 
| Thorsten Scherler
| COO Spain
| Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
| http://www.wyona.com                   http://lenya.apache.org
| thorsten.scherler@wyona.com                thorsten@apache.org
|
|
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.23/242 - Release Date: 
26/01/2006
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 27/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re: Exampleusecase)

Posted by Thorsten Scherler <th...@wyona.com>.
El vie, 27-01-2006 a las 17:59 +0800, Gav.... escribió:
> ----- Original Message ----- 

...
> |
> | Actually since Cyriaque and yourself seem to prefer that the default
> | behavior would be non enclosing divs we can change the default
> | behavior.
> |
> | wdyt?
> 
> I have found another reason why it is best to close these divs properly.
> 
> e.g.
> 
>  <forrest:contract name="content-abstract">
>             <forrest:properties contract="content-abstract">
>               <forrest:property name="content-abstract" 
> nugget="get.abstract">
>                 <jx:import 
> uri="cocoon://#{$cocoon/parameters/getRequest}.abstract.xml"/>
>               </forrest:property>
>             </forrest:properties>
>  </forrest:contract>
> 
> If there is content to return into this content-abstract request then that 
> is fine, on pages where there may not be any content available to return, 
> then the contract is blank. This creates a <div class="abstract" /> . It so 
> happens that most style sheets I looked at give the abstract div an 'italic' 
> font-style. Because the div is not closed properly, the rest of the content 
> (content-main, content-minitoc-area etc.. ) that follows this self-closed 
> div are also outputting the 'italic' font-style.
> 
> I looked for ages as to why my main content was italic, its because I have 
> no abtract-content in the xml source to give.
> 
> I suppose one has to decide to either use a contract like this for all pages 
> or for none.

Why not check whether there is an abstract and if not omit the div?
<xsl:if test="$content-abstract/div[@class='abstract']/*">
 <xsl:copy-of 
          select="$content-abstract/div[@class='abstract']"/>
</xsl:if>

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org


Re: Best way to add repeatable code in v2/v3 (was Re: Exampleusecase)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@apache.org>
To: <de...@forrest.apache.org>
Sent: Sunday, January 22, 2006 9:56 PM
Subject: Re: Best way to add repeatable code in v2/v3 (was Re: 
Exampleusecase)

<snip >

| > | <forrest:hook name="headlines"></forrest:hook>
| > | creates
| > | <div id="headlines />
| > |
| > | and <forrest:hook name="headlines" nbsp="true"></forrest:hook>
| > | gives
| > | <div id="headlines"> </div>
| > |
| > | We need to document this in the howto, but self enclosing divs are
| > | default in the dispatcher, no bug!
| >
| > Thats fine, I will send in a patch to document this. I can not really
| > think of a situation (except in testing) where I would want an
| > empty div anyway, but came across it so mentioned it.
|
| Actually since Cyriaque and yourself seem to prefer that the default
| behavior would be non enclosing divs we can change the default
| behavior.
|
| wdyt?

I have found another reason why it is best to close these divs properly.

e.g.

 <forrest:contract name="content-abstract">
            <forrest:properties contract="content-abstract">
              <forrest:property name="content-abstract" 
nugget="get.abstract">
                <jx:import 
uri="cocoon://#{$cocoon/parameters/getRequest}.abstract.xml"/>
              </forrest:property>
            </forrest:properties>
 </forrest:contract>

If there is content to return into this content-abstract request then that 
is fine, on pages where there may not be any content available to return, 
then the contract is blank. This creates a <div class="abstract" /> . It so 
happens that most style sheets I looked at give the abstract div an 'italic' 
font-style. Because the div is not closed properly, the rest of the content 
(content-main, content-minitoc-area etc.. ) that follows this self-closed 
div are also outputting the 'italic' font-style.

I looked for ages as to why my main content was italic, its because I have 
no abtract-content in the xml source to give.

I suppose one has to decide to either use a contract like this for all pages 
or for none.

Gav... 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/242 - Release Date: 26/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re: Example usecase)

Posted by Thorsten Scherler <th...@apache.org>.
El dom, 22-01-2006 a las 21:38 +0800, Gav.... escribió:
> ----- Original Message ----- 
> From: "Thorsten Scherler" <th...@apache.org>
> To: <de...@forrest.apache.org>
> Sent: Sunday, January 22, 2006 9:26 PM
> Subject: Re: Best way to add repeatable code in v2/v3 (was Re: Example 
> usecase)
> 
> 
> | El dom, 22-01-2006 a las 21:09 +0800, Gav.... escribió:
> | ...
> | > |
> | > | > P.S-
> | > | >
> | > | > Creating an empty hook has the side effect of a self closing div -
> | > obviously
> | > | > inlvalid and messes
> | > | > up the rest of the page.
> | > |
> | > | Raise an issue (if there isn't one already, this is ringing a bell
> | > | somewhere in the deep recesses of my mind).
> | >
> | > I will raise an issue, I had a good look for one but could not
> | > find a relevent one.
> |
> | Hmm, did you read the other mail I wrote?
> 
> Yes, I posted this earlier than that one arrived though.
> 
> |
> | 
> forrest-trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/hooksMatcher.xsl
> | ...
> | <xsl:if test="@nbsp='true'">&#160;</xsl:if>
> | ...
> |
> | Meaning
> | <forrest:hook name="headlines"></forrest:hook>
> | creates
> | <div id="headlines />
> |
> | and <forrest:hook name="headlines" nbsp="true"></forrest:hook>
> | gives
> | <div id="headlines"> </div>
> |
> | We need to document this in the howto, but self enclosing divs are
> | default in the dispatcher, no bug!
> 
> Thats fine, I will send in a patch to document this. I can not really
> think of a situation (except in testing) where I would want an
> empty div anyway, but came across it so mentioned it.

Actually since Cyriaque and yourself seem to prefer that the default
behavior would be non enclosing divs we can change the default
behavior. 

wdyt?

> 
> I did see the resolution you mention in the whiteboard and on list [1]
> but wasn't sure of the final outcome.
> 
> Thanks. Now if you could point me in the right direction regarding
> the subject title ;>)

jeje, yeah, after I fixed the httpd bug on lenya.zones. 

salu2

> 
> [1] - 
> http://mail-archives.apache.org/mod_mbox/forrest-dev/200507.mbox/%3C42EA35BD.5080008@pcotech.fr%3E
> 
> Gav...
> 
> |
> | salu2
> | -- 
> | thorsten
> |
> | "Together we stand, divided we fall!"
> | Hey you (Pink Floyd)
> |
> |
> |
> |
> | -- 
> | No virus found in this incoming message.
> | Checked by AVG Free Edition.
> | Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 
> 20/01/2006
> |
> | 
> 
> 
> 
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: Best way to add repeatable code in v2/v3 (was Re: Example usecase)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@apache.org>
To: <de...@forrest.apache.org>
Sent: Sunday, January 22, 2006 9:26 PM
Subject: Re: Best way to add repeatable code in v2/v3 (was Re: Example 
usecase)


| El dom, 22-01-2006 a las 21:09 +0800, Gav.... escribió:
| ...
| > |
| > | > P.S-
| > | >
| > | > Creating an empty hook has the side effect of a self closing div -
| > obviously
| > | > inlvalid and messes
| > | > up the rest of the page.
| > |
| > | Raise an issue (if there isn't one already, this is ringing a bell
| > | somewhere in the deep recesses of my mind).
| >
| > I will raise an issue, I had a good look for one but could not
| > find a relevent one.
|
| Hmm, did you read the other mail I wrote?

Yes, I posted this earlier than that one arrived though.

|
| 
forrest-trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/hooksMatcher.xsl
| ...
| <xsl:if test="@nbsp='true'">&#160;</xsl:if>
| ...
|
| Meaning
| <forrest:hook name="headlines"></forrest:hook>
| creates
| <div id="headlines />
|
| and <forrest:hook name="headlines" nbsp="true"></forrest:hook>
| gives
| <div id="headlines"> </div>
|
| We need to document this in the howto, but self enclosing divs are
| default in the dispatcher, no bug!

Thats fine, I will send in a patch to document this. I can not really
think of a situation (except in testing) where I would want an
empty div anyway, but came across it so mentioned it.

I did see the resolution you mention in the whiteboard and on list [1]
but wasn't sure of the final outcome.

Thanks. Now if you could point me in the right direction regarding
the subject title ;>)

[1] - 
http://mail-archives.apache.org/mod_mbox/forrest-dev/200507.mbox/%3C42EA35BD.5080008@pcotech.fr%3E

Gav...

|
| salu2
| -- 
| thorsten
|
| "Together we stand, divided we fall!"
| Hey you (Pink Floyd)
|
|
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 
20/01/2006
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re: Example use case)

Posted by Thorsten Scherler <th...@apache.org>.
El dom, 22-01-2006 a las 21:09 +0800, Gav.... escribió:
...
> |
> | > P.S-
> | >
> | > Creating an empty hook has the side effect of a self closing div - 
> obviously
> | > inlvalid and messes
> | > up the rest of the page.
> |
> | Raise an issue (if there isn't one already, this is ringing a bell
> | somewhere in the deep recesses of my mind).
> 
> I will raise an issue, I had a good look for one but could not
> find a relevent one.

Hmm, did you read the other mail I wrote?

forrest-trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/hooksMatcher.xsl
...
<xsl:if test="@nbsp='true'">&#160;</xsl:if>
...

Meaning 
<forrest:hook name="headlines"></forrest:hook>
creates
<div id="headlines />

and <forrest:hook name="headlines" nbsp="true"></forrest:hook>
gives
<div id="headlines"> </div>

We need to document this in the howto, but self enclosing divs are
default in the dispatcher, no bug!

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: Best way to add repeatable code in v2/v3 (was Re: Example use case)

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Ross Gardler" <rg...@apache.org>
To: <de...@forrest.apache.org>
Sent: Sunday, January 22, 2006 2:00 AM
Subject: [spam score=82%] Re: Best way to add repeatable code in v2/v3 (was 
Re: Example use case)


| Gav.... wrote:
| > Hi All,
| >
| > On the right hand side of http://minitutorials.com I have some 
'headlines'
| > in a 'headlines' div
| > All boxes are in a 'rightbar' div also.
| > The code for this is in One file called rightnav.ssi and included using
| > either 'include' or 'require'
| > This obviously has the effect that all of the site pages get the content
| > from the one file.
|
| ...
|
| > 3. The html code required I transfered from rightnav.ssi into 
rightnav.html
| > and put this file
| > into xdocs directory. I am hoping that the <url>/rightbar.html</url> is
| > therefore correct.
| >
| > 4. Didn't see what else I would need to do, so did a 'forrest run' , did 
not
| > show up.
| >     Also did a ForrestBot onto the web server, also does not show up.
| >
| > So, this did not work, the question is, have I done something wrong, 
missed
| > something out
| > or is there a different/better way to include content into the 
'headlines'
| > hook ?
|
| I've not checked your syntax as I am not familiar enough with these
| contracts to see it without cross-checking with the documentation, which
| I assume you have done. Others will be better at spotting syntax errors.

It seems correct from the docs I could find. The docs do specify that
the included file needs to be a forrest generated html source file. Putting
in rightnav.html into xdocs doesn't seem to be enough, as it is not being
linked to from anywhere (apart from this contract), then I guess it is
not being generated - a rightnav.html does not get reproduced into
a generated site.

|
| Assuming syntax is correct. Have you verified that requesting
| "http://localhost:8888/rightbar.html" actually returns some code?

No it doesn't, I get a can not find rightbar.xml error

|
| The other thing is that I wrote this contract for V1. There have been
| many changes since then, including the use of JX. I'm not sure if this
| is still the "right" way to include content.

It seems most of the newer contracts are using JX, maybe v2/v3 need
it to be this way. Any mention of JX on the forrest site says to refer
to cocoon docs for howto's , I don't really want to start wandering
in that direction though.
|
| > Alternative I thought of would be to create a contract for it. Although 
I
| > can see how to
| > create a contract, not sure again on the best way of approaching it. 
Maybe
| > doing a similar
| > thing as including the body from say index.xml but using
| > rightnavcontent.xml, use jx: ??
|
| See above - we need a views savvy dev to advise here.

Good idea, I'll wait for them to wake up and flood the list :)

|
| > (Re-reading the above, I see at least (at last ?)  I have suggestions, 
so
| > must be learning something!)
|
| :-) and you're teaching those of us still trying to get to grips with
| views (when I taught at Universities I always used to learn loads by
| doing the labs when students would ask me why their code behaved this
| way or that way).
|
| > P.S-
| >
| > Creating an empty hook has the side effect of a self closing div - 
obviously
| > inlvalid and messes
| > up the rest of the page.
|
| Raise an issue (if there isn't one already, this is ringing a bell
| somewhere in the deep recesses of my mind).

I will raise an issue, I had a good look for one but could not
find a relevent one.

Gav...

|
| Ross
|
|
| -- 
| No virus found in this incoming message.
| Checked by AVG Free Edition.
| Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 
20/01/2006
|
| 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006



Re: Best way to add repeatable code in v2/v3 (was Re: Example use case)

Posted by Ross Gardler <rg...@apache.org>.
Gav.... wrote:
> Hi All,
> 
> On the right hand side of http://minitutorials.com I have some 'headlines' 
> in a 'headlines' div
> All boxes are in a 'rightbar' div also.
> The code for this is in One file called rightnav.ssi and included using 
> either 'include' or 'require'
> This obviously has the effect that all of the site pages get the content 
> from the one file.

...

> 3. The html code required I transfered from rightnav.ssi into rightnav.html 
> and put this file
> into xdocs directory. I am hoping that the <url>/rightbar.html</url> is 
> therefore correct.
> 
> 4. Didn't see what else I would need to do, so did a 'forrest run' , did not 
> show up.
>     Also did a ForrestBot onto the web server, also does not show up.
> 
> So, this did not work, the question is, have I done something wrong, missed 
> something out
> or is there a different/better way to include content into the 'headlines' 
> hook ?

I've not checked your syntax as I am not familiar enough with these 
contracts to see it without cross-checking with the documentation, which 
I assume you have done. Others will be better at spotting syntax errors.

Assuming syntax is correct. Have you verified that requesting 
"http://localhost:8888/rightbar.html" actually returns some code?

The other thing is that I wrote this contract for V1. There have been 
many changes since then, including the use of JX. I'm not sure if this 
is still the "right" way to include content.

> Alternative I thought of would be to create a contract for it. Although I 
> can see how to
> create a contract, not sure again on the best way of approaching it. Maybe 
> doing a similar
> thing as including the body from say index.xml but using 
> rightnavcontent.xml, use jx: ??

See above - we need a views savvy dev to advise here.

> (Re-reading the above, I see at least (at last ?)  I have suggestions, so 
> must be learning something!)

:-) and you're teaching those of us still trying to get to grips with 
views (when I taught at Universities I always used to learn loads by 
doing the labs when students would ask me why their code behaved this 
way or that way).

> P.S-
> 
> Creating an empty hook has the side effect of a self closing div - obviously 
> inlvalid and messes
> up the rest of the page.

Raise an issue (if there isn't one already, this is ringing a bell 
somewhere in the deep recesses of my mind).

Ross

Re: character entities

Posted by Thorsten Scherler <th...@apache.org>.
El mié, 25-01-2006 a las 16:34 +0800, Gav.... escribió:
> -
...
> |
> | Jeje, nice theory, but I have an example where you do not combine &#160;
> | with " and still the described behavior can be seen.
> |
> |        <forrest:hook class="breadtrail">
> |          <forrest:contract name="genericMarkup">
> |            <forrest:properties contract="genericMarkup">
> |              <forrest:property name="genericMarkup">
> |                <strong>&#160;</strong>
> |              </forrest:property>
> |            </forrest:properties>
> |          </forrest:contract>
> |        </forrest:hook>
> 
> Yes, it was a theory, it  was late also.
> What does a strong space look like :)
> 

lol It is a trick, because the genericMarkup contract is expecting
markup and not single strings. ;-)

> |
> |
> | >
> | > Anyway, in the example contract code above, removing &#160; and putting 
> a
> | > real space in there cures it and the space
> | > is preserved no problem as it is enclosed between the quotes.
> | >
> | > I copied the contract to my /pili/html/ directory and it now renders
> | > correctly.
> | >
> | > Have I missed something here or was it that simple ?
> | >
> |
> | Actually regarding http://www.html-world.de/program/html_sz.php
> | Unicode: &nbsp;
> | XML: &#160;
> | Result: space
> |
> | We are using the right code for spaces. I guess you need to set the
> | locale to UTF-8 on the server (before starting httpd), since forrest is
> | rendering it on lenya.zones just fine but the httpd is delivering the
> | content with "Â".
> 
> I am not disputing that &#160; is a space, my argument and what my
> solution above was that you need not employ &#160; all the time -
> especially when text is surrounded by quotes.
> 
> The example text is :-
> 
> ("<i18n:text >Last Published:</i18n:text>&#160;" + document.lastModified);
> 
> The &#160; is there to put a space between the : and the date produced by
> document.lastModified. I do not see a reason for using &#160; in this case
> the same as there is no &#160; between the words 'Last' and 'Published'
> 
> What works for me is :-
> 
> ("<i18n:text >Last Published:</i18n:text> " + document.lastModified);
> 
> That 'space' is legal and universal, it is enclosed in quotes and so will
> get converted correctly no matter how the locale is set on the server.
> 
> Also for some, there will definatly be problems in getting their web server
> locale changed. I can change my locale on my server no problem, however
> apache.minitutorials.com and some of my other sites are remotely hosted
> by different ISPs, I doubt they will change on my say so. I guess this to
> be true of many Forrest users.

Yeah, you are right for above contract or any other xsl based code where
you always have the solution of <xsl:text> </xsl:text> or the one you
described, but the problem is actually bigger then this. Like seen in
the "strong space" example, you may want a single space in some hooks or
better in the structurer. 

I can understand that some server are out of control and the
configuration may be given, but as David points out normally you can
control it via .htaccess which all ISP should allow. 

I do not know atm a simple solution but I know that the source of
http://lenya.zones.apache.org/index.html on the servers DOC_ROOT looks
like:
<?xml version="1.0" encoding="UTF-8"?>
...
<div id="publishedStrip">
 <script type="text/javascript">document.write("Today: " + new
Date());</script>
</div>

...and looking on the source code of above link I can find:
<?xml version="1.0" encoding="UTF-8"?>
...
<div id="publishedStrip">
 <script type="text/javascript">document.write("Today:Â " + new
Date());</script>
</div>

Now the question is who to blame that the encoding is ignored? Like
stated above in some situation (e.g. not based on xsl) you need to use
the *right* way for defining spaces in utf-8 (&#160;), what about this
situations?

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Re: character entities

Posted by "Gav...." <br...@brightontown.com.au>.
----- Original Message ----- 
From: "Thorsten Scherler" <th...@apache.org>
To: <de...@forrest.apache.org>
Sent: Sunday, January 22, 2006 8:35 PM
Subject: Re: character entities


| El sáb, 21-01-2006 a las 22:41 +0800, Gav.... escribió:
| > I wrote earlier :-
| >
| > | P.S-
| > |
| > | Creating an empty hook has the side effect of a self closing div -
| > obviously
| > | inlvalid and messes
| > | up the rest of the page.
| > |
| > | e.g.
| > |
| > | <forrest:hook name="headlines"></forrest:hook>
| > | creates
| > | <div id="headlines />
| > | instead of
| > | <div id="headlines"></div>
| > |
| >
| > This made me have a look around, and as a side-effect found an old
| > thread regarding this back in July 2005, just before my time I think.
| >
| > The discussion also brought up &#160; and its possible side effects
| > of creating  .
|
| Yeah, I am running into the same problem ATM. You can see it online at
| http://lenya.zones.apache.org/ "Today:Â..." (I am looking right now to
| fix that, so the site may be fixed if you visit it)
|
| On my local machine that does not happen. I have run into a similar
| problem with cocoon on a job I did a while ago. The problem was lying in
| the server configuration, now I just looked on our zones server:
| Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
| -bash-3.00$ locale
| LANG=
| LC_CTYPE="C"
| LC_NUMERIC="C"
| LC_TIME="C"
| LC_COLLATE="C"
| LC_MONETARY="C"
| LC_MESSAGES="C"
| LC_ALL=
|
| The locale is not UTF-8!
|
| Doing "locale" on my machine gives:
| LANG=es_ES.UTF-8
| LC_CTYPE="es_ES.UTF-8"
| LC_NUMERIC="es_ES.UTF-8"
| LC_TIME="es_ES.UTF-8"
| LC_COLLATE="es_ES.UTF-8"
| LC_MONETARY="es_ES.UTF-8"
| LC_MESSAGES="es_ES.UTF-8"
| LC_PAPER="es_ES.UTF-8"
| LC_NAME="es_ES.UTF-8"
| LC_ADDRESS="es_ES.UTF-8"
| LC_TELEPHONE="es_ES.UTF-8"
| LC_MEASUREMENT="es_ES.UTF-8"
| LC_IDENTIFICATION="es_ES.UTF-8"
| LC_ALL=
|
| That is UTF-8!
|
| The solution back on the job was setting the language to de_DE.UTF-8
| before starting the tomcat server.
|
| >
| > I am seeing  a lot lately and so think the problem is still not solved.
|
| Yeah, we need to find the root cause of this problem. I guess it is
| lying in the "locale".
|
| > For instance it is the result of siteinfo-last-published.ft.
| >
| > Last Published:Â 01/21/2006 17:53:37
| >
| > This line is created from the contract here :-
| >
| > <xsl:template name="siteinfo-last-published-body">
| >         <script type="text/javascript">document.write("<i18n:text >Last
| > Published:</i18n:text>&#160;" + document.lastModified);</script>
| >       </xsl:template>
| >
| > I have a theory.
| >
| > in the code the &#160; is right next to a " (quote). The entity number 
for "
| > (quote) is &#34;
| >
| > I had a crazy thought that maybe they were adding together somehow.
| > (160+34=194)
| >
| > &#160; + &#34; = &#194;
| >
| > Guess what &#194; is equal to , yup :-
| >
| > Â
|
| Jeje, nice theory, but I have an example where you do not combine &#160;
| with " and still the described behavior can be seen.
|
|        <forrest:hook class="breadtrail">
|          <forrest:contract name="genericMarkup">
|            <forrest:properties contract="genericMarkup">
|              <forrest:property name="genericMarkup">
|                <strong>&#160;</strong>
|              </forrest:property>
|            </forrest:properties>
|          </forrest:contract>
|        </forrest:hook>

Yes, it was a theory, it  was late also.
What does a strong space look like :)

|
|
| >
| > Anyway, in the example contract code above, removing &#160; and putting 
a
| > real space in there cures it and the space
| > is preserved no problem as it is enclosed between the quotes.
| >
| > I copied the contract to my /pili/html/ directory and it now renders
| > correctly.
| >
| > Have I missed something here or was it that simple ?
| >
|
| Actually regarding http://www.html-world.de/program/html_sz.php
| Unicode: &nbsp;
| XML: &#160;
| Result: space
|
| We are using the right code for spaces. I guess you need to set the
| locale to UTF-8 on the server (before starting httpd), since forrest is
| rendering it on lenya.zones just fine but the httpd is delivering the
| content with "Â".

I am not disputing that &#160; is a space, my argument and what my
solution above was that you need not employ &#160; all the time -
especially when text is surrounded by quotes.

The example text is :-

("<i18n:text >Last Published:</i18n:text>&#160;" + document.lastModified);

The &#160; is there to put a space between the : and the date produced by
document.lastModified. I do not see a reason for using &#160; in this case
the same as there is no &#160; between the words 'Last' and 'Published'

What works for me is :-

("<i18n:text >Last Published:</i18n:text> " + document.lastModified);

That 'space' is legal and universal, it is enclosed in quotes and so will
get converted correctly no matter how the locale is set on the server.

Also for some, there will definatly be problems in getting their web server
locale changed. I can change my locale on my server no problem, however
apache.minitutorials.com and some of my other sites are remotely hosted
by different ISPs, I doubt they will change on my say so. I guess this to
be true of many Forrest users.

Gav... 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.22/239 - Release Date: 24/01/2006



Re: character entities

Posted by Thorsten Scherler <th...@apache.org>.
El sáb, 21-01-2006 a las 22:41 +0800, Gav.... escribió:
> I wrote earlier :-
> 
> | P.S-
> |
> | Creating an empty hook has the side effect of a self closing div - 
> obviously
> | inlvalid and messes
> | up the rest of the page.
> |
> | e.g.
> |
> | <forrest:hook name="headlines"></forrest:hook>
> | creates
> | <div id="headlines />
> | instead of
> | <div id="headlines"></div>
> |
> 
> This made me have a look around, and as a side-effect found an old
> thread regarding this back in July 2005, just before my time I think.
> 
> The discussion also brought up &#160; and its possible side effects
> of creating  .

Yeah, I am running into the same problem ATM. You can see it online at 
http://lenya.zones.apache.org/ "Today:Â..." (I am looking right now to
fix that, so the site may be fixed if you visit it)

On my local machine that does not happen. I have run into a similar
problem with cocoon on a job I did a while ago. The problem was lying in
the server configuration, now I just looked on our zones server:
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
-bash-3.00$ locale
LANG=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

The locale is not UTF-8!

Doing "locale" on my machine gives:
LANG=es_ES.UTF-8
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=

That is UTF-8!

The solution back on the job was setting the language to de_DE.UTF-8
before starting the tomcat server.

> 
> I am seeing  a lot lately and so think the problem is still not solved.

Yeah, we need to find the root cause of this problem. I guess it is
lying in the "locale".

> For instance it is the result of siteinfo-last-published.ft.
> 
> Last Published:Â 01/21/2006 17:53:37
> 
> This line is created from the contract here :-
> 
> <xsl:template name="siteinfo-last-published-body">
>         <script type="text/javascript">document.write("<i18n:text >Last 
> Published:</i18n:text>&#160;" + document.lastModified);</script>
>       </xsl:template>
> 
> I have a theory.
> 
> in the code the &#160; is right next to a " (quote). The entity number for " 
> (quote) is &#34;
> 
> I had a crazy thought that maybe they were adding together somehow. 
> (160+34=194)
> 
> &#160; + &#34; = &#194;
> 
> Guess what &#194; is equal to , yup :-
> 
> Â

Jeje, nice theory, but I have an example where you do not combine &#160;
with " and still the described behavior can be seen.

        <forrest:hook class="breadtrail">
          <forrest:contract name="genericMarkup">
            <forrest:properties contract="genericMarkup">
              <forrest:property name="genericMarkup">
                <strong>&#160;</strong>
              </forrest:property>
            </forrest:properties>
          </forrest:contract>
        </forrest:hook>


> 
> Anyway, in the example contract code above, removing &#160; and putting a 
> real space in there cures it and the space
> is preserved no problem as it is enclosed between the quotes.
> 
> I copied the contract to my /pili/html/ directory and it now renders 
> correctly.
> 
> Have I missed something here or was it that simple ?
> 

Actually regarding http://www.html-world.de/program/html_sz.php 
Unicode: &nbsp;
XML: &#160;
Result: space

We are using the right code for spaces. I guess you need to set the
locale to UTF-8 on the server (before starting httpd), since forrest is
rendering it on lenya.zones just fine but the httpd is delivering the
content with "Â".

More information about utf-8 and unicode can be found on [1]. How to set
it in Gentoo [2] is in spanish only but I reckon you still can get the
idea following the coding examples. Finally [3] a smaller howto in
english.

> Still looking into the empty <div> problem but again may be &#160; related 
> I'm not sure.

No, IMO not, see above.

> There was talk in the archives it was cured, but seems to be back.
> 

forrest-trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.structurer/resources/stylesheets/hooksMatcher.xsl
...
<xsl:if test="@nbsp='true'">&#160;</xsl:if>
...

Meaning 
<forrest:hook name="headlines"></forrest:hook>
creates
<div id="headlines />

and <forrest:hook name="headlines" nbsp="true"></forrest:hook>
gives
<div id="headlines"> </div>

We need to document this in the howto.

HTH
salu2

[1]http://www.cl.cam.ac.uk/~mgk25/unicode.html
[2]http://es.gentoo-wiki.com/Unicode-UTF-8
[3]http://www.linux.com/howtos/Indic-Fonts-HOWTO/locale.shtml
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


character entities

Posted by "Gav...." <br...@brightontown.com.au>.
I wrote earlier :-

| P.S-
|
| Creating an empty hook has the side effect of a self closing div - 
obviously
| inlvalid and messes
| up the rest of the page.
|
| e.g.
|
| <forrest:hook name="headlines"></forrest:hook>
| creates
| <div id="headlines />
| instead of
| <div id="headlines"></div>
|

This made me have a look around, and as a side-effect found an old
thread regarding this back in July 2005, just before my time I think.

The discussion also brought up &#160; and its possible side effects
of creating  .

I am seeing  a lot lately and so think the problem is still not solved.

For instance it is the result of siteinfo-last-published.ft.

Last Published:Â 01/21/2006 17:53:37

This line is created from the contract here :-

<xsl:template name="siteinfo-last-published-body">
        <script type="text/javascript">document.write("<i18n:text >Last 
Published:</i18n:text>&#160;" + document.lastModified);</script>
      </xsl:template>

I have a theory.

in the code the &#160; is right next to a " (quote). The entity number for " 
(quote) is &#34;

I had a crazy thought that maybe they were adding together somehow. 
(160+34=194)

&#160; + &#34; = &#194;

Guess what &#194; is equal to , yup :-

Â

Anyway, in the example contract code above, removing &#160; and putting a 
real space in there cures it and the space
is preserved no problem as it is enclosed between the quotes.

I copied the contract to my /pili/html/ directory and it now renders 
correctly.

Have I missed something here or was it that simple ?

Still looking into the empty <div> problem but again may be &#160; related 
I'm not sure.
There was talk in the archives it was cured, but seems to be back.

HTH

Gav... 



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006