David Harris <[EMAIL PROTECTED]> writes:

>Jürgen,

>If Image.vm does not exist then what is going in the Velocity template 
>file that contains the following line?

><img src="$link.setPage("mrtg,Image.vm")" border="0"/>

There is no template. It goes like this:

template name == "mrtg,Image.vm"

Now Turbine asks Template Service the following question:

What is the screen class that you map the following  template
name to: "mrtg,Image.vm"

Answer from TemplateService: mrtg.Image

Now Turbine asks the AssemblerBroker Service to supply an actual
class to this class name fragment

Aanswer from AssemblerBroker:  de.byteaction.mrtg.Image
                               ^^^^^^^^^^^^^
                               This comes from the module.package list
                               property in TR.props


Note that this class does _NOT_ expand VelocityScreen. As the result,
the TemplateService is _never_ asked about an actual template
name. Because this happens from the VelocityScreen (or better: the
TemplateScreen of which VelocityScreen is a subclass)

So this returned screen class is run. And it returns the output which
is in turn displayed.

Once you've wrapped your brain around the following two facts:

- The Template Service has nothing to do with Templates as in
  "Velocity Templates" but only with how a certain parameter (called

  "template"), which contains a comma-separated string is mapped to
  java classes (Screen, Layout, Page, Navigation) and Template names
  (as in  Velocity Template). (BTW: Mapping this template name to an
  actual file is the job of the TemplateEngine (in most cases:
  VelocityService).

- Using templates in Turbine as output elements like Screens, Layouts
  and Navigations is actually _AN_ _AFTERTHOUGHT_ from the original 
  core which uses Java classes everywhere and is implemented by using
  special, Turbine-supplied classes to map the Class references to 
  (VelocityScreen, VelocityPage, VelocityOnlyLayout and friends).

then you will notice that everything simply falls into place. In fact,
Juergen has actually confused you a little by writing

<img src="$link.setPage("mrtg,Image.vm")" border="0"/>

because strictly spoken, he wants

<img src="$link.setScreen("mrtg.Image")" border="0" /> 

which makes clear that here no template is used. By giving a reference
to a template (which results in /template/mrg,Image.vm/ being in the
PATH_INFO), he simply triggers the template service to replace this
parameter with the screen class he actually wants to load.

        Regards
                Henning
-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
[EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

"Fighting for one's political stand is an honourable action, but re-
 fusing to acknowledge that there might be weaknesses in one's
 position - in order to identify them so that they can be remedied -
 is a large enough problem with the Open Source movement that it
 deserves to be on this list of the top five problems."
                       -- Michelle Levesque, "Fundamental Issues with
                                    Open Source Software Development"

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to