The $content is a context tool named ContentURI recently added (Fri 8)
to turbine (a updated version of the ImageURI). You need to get
this file (you can place temporarily it in your WEB-INF/src, compile it
and update your screen (or the TurbineVelocityService) to put an
instance of it into the context.
You can get the updated sources direclty online from:
http://www.working-dogs.com/turbine/cvsweb/index.cgi/turbine/src \
turbine/src/java/org/apache/turbine/util/ContentURI.java
and
turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
:) Christoph
Colin Chalmers wrote:
>
> Hi Rafal,
>
> Thanx for the help, I'm almost there but not quite :-(
>
> If I use the following link
>
> <img src="/foo/images/logo.gif">
>
> where foo is the name of the webapp I'm using then it appears to work OK,
> however if I use what you propose
>
> $content.getURI("/images/logo.gif")
>
> then things still go wrong. The error in the template is
>
> warning: attempt to write out undefined variable
> content.getURI(/images/logo.gif): java.lang.NullPointerException
>
> I'm sure it's something to do with the mapping to the images dir. But that's
> a bit of a grey area for me.
> Any more tips/time that you can spare me would be much appreciated.
>
> Colin
>
> > Colin Chalmers wrote:
> > > We've been having some trouble with the path to images. We were using
> > > absolute paths but found this a bit restrictive.
> > > I looked into earlier messages and found something called
> > > "$image.setImage()". Unfortunately I can't find any other info related
> to
> > > this.
> > >
> > > Do I need to set it somewhere or does it work "automatically". How does
> > > Turbine know where the images directory is?
> >
> > If you are using Tomcat or another Servlets 2.2 compliant Servlet
> > Container,
> > Turbine runns within a 'web application' which is contained in a
> > directory.
> >
> > Each web application is mapped onto a 'context' inside the servers URL
> > namespace.
> >
> > URL namespace
> >
> > http://server.acme.com/foo/images/blank.gif or /foo/images/blank.gif
> > --- ---
> > context
> >
> > servers filesystem namespace
> >
> > /usr/local/tomcat/webapps/foo/images/blank.gif
> > ----------------------------
> > web application
> >
> > To reference an image, you need to put context name into the URLs and
> > then
> > the path witin your webapp.
> >
> > You can do it in a convinent way using the following in your WebMacro
> > template
> >
> > $content.getURI("/images/blank.gif")
> >
> > note that it doesn't guess the path to the 'images' directory. You need
> > to specify the path from your webapp root.
> >
> > Hope that helps...
> >
> >
> > Rafal
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]