You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Anthony Smith <an...@fedex.com> on 2004/05/19 21:01:58 UTC

Difference between screen and template.

Could somepne explain to to me the difference or one reason to use on over
the other?


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Difference between screen and template.

Posted by Jeffery Painter <pa...@kiasoft.com>.
the difference between screen and template... there really is no physical 
template, the TemplateService puts together the final HTML output based on
your Layout, Navigations and then finally your Screen.

You should have a default layout which specifies the position of your 
navigations (if you have any) and the $screen_placeholder which is
the location for the contents of your Screen.

1.  /template/app/layouts
2.  /template/app/navigations
3.  /template/app/screens

Layout -> think overall position of elements on screen

You can override layout in the screen by manipulating the 
RunData object

 data.setLayoutTemplate()

Screen -> the data, content, you wish to display

You can change the screen that is loaded by using setTemplate() in your 
screen class

 setTemplate( data, "MyScreen.vm" )

setTemplate is really specifying which Screen to use (this could 
be a cause of confusion, since it is the screen and not a template we are 
specifying)

and NEVER use the "/" slash mark when specifying which pages to load, you 
should use the "," constructor

Read these pages again if you need a reference.

http://jakarta.apache.org/turbine/turbine-2.3/howto/velocity-site-howto.html
http://jakarta.apache.org/turbine/turbine-2.3/services/template-service.html

The two golden rules when using Templates with Turbine

    * 1) Many examples and docs from older Turbine code show template 
	paths with a slashes.
      Repeat after me: TEMPLATE NAMES NEVER CONTAIN SLASHES!
      Template names are separated by "," (the comma).

    * 2) Many examples and docs from older Turbine code show templates 
	that start with "/". This is not only a violation of the rule above but 
	actively breaks things like loading templates from a jar with the velocity 
	jar loader.

      Repeat after me: TEMPLATE NAMES ARE NOT PATHS. THEY'RE NOT ABSOLUTE 
	AND HAVE NO LEADING /.



On Wed, 19 May 2004, Anthony Smith wrote:

> Could somepne explain to to me the difference or one reason to use on over
> the other?
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org