You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Akshay Kapur <ak...@cisco.com> on 2002/12/12 19:32:53 UTC

Comma in the URL in the Template path

index.vm is places under templates/services

The URL to access is http://localhost/servlet/template/services,index.vm

I have two questions -

a. Is there anyway to remove the comma by a slash in the above URL?

b. In my templates, I have to set the links as $link.setPage( 
"services,index.vm" ). When I replace the comma by a slash, it doesn't 
work. As per the HowTo on Velocity Context, it should 
(http://jakarta.apache.org/turbine/turbine-2/howto/velocity-site-howto.html).

Am I missing a point or is the comma the only way to code and access?

Thanks
Akshay

IMPORTANT TEMPLATE INFO [was Re: Comma in the URL in the Template path]

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Akshay Kapur <ak...@cisco.com> writes:

>The URL to access is http://localhost/servlet/template/services,index.vm

>I have two questions -

>a. Is there anyway to remove the comma by a slash in the above URL?

Why would you? There is one really important thing to remember when
dealing with Turbine:

TEMPLATE NAMES ARE NOT PATHES! :-)

What you have here is a variable which says

template = services,index.vm

The Velocity Service is able to find that template from a loader
(Which, in case of the file loader, is the file "index.vm" in the
"services" subdirectory).

Most important rule in dealing with templates: "If you have a / and
.vm in a template name, you're wrong and you will run into trouble
sooner or later". Trust me. BTDTGTT.

And you should _NEVER_, _NEVER_, _NEVER_ try to prefix your template
names with "/".

This is wrong:   $link.setTemplate("/services,index.vm")

(which is template = /services,index.vm)

If you don't believe me, do the fun and jar up your templates in a jar
and try to use the jarloader.

So: Simply ignore the "," Turbine is doing the right thing. Trust it. :-)

There are no such things as "relative template pathes". A template has
a name which must always be fully qualified. So you neither need a
prefix to mark the name as "absolute" nor is "/" a component
divisor. The "," is.

>b. In my templates, I have to set the links as $link.setPage( 
>"services,index.vm" ). When I replace the comma by a slash, it doesn't 
>work. As per the HowTo on Velocity Context, it should 

Yes. The Howto is wrong. Sorry.

>Am I missing a point or is the comma the only way to code and access?

Yes. The template is called "services,index.vm" It is then searched by
the various Velocity loaders and in case of the file loader, loaded from
<basedirectory>/services/index.vm. It might well have been loaded by
a fictious sql-template loader from the "services" table, row "index.vm".

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen       -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH     hps@intermeta.de

Am Schwabachgrund 22  Fon.: 09131 / 50654-0   info@intermeta.de
D-91054 Buckenhof     Fax.: 09131 / 50654-20   

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>