Foren

How to call another vm files from portal_normal.vm

thumbnail
Joseph John, geändert vor 12 Jahren.

How to call another vm files from portal_normal.vm

Junior Member Beiträge: 75 Beitrittsdatum: 26.07.11 Neueste Beiträge
Hi
I have just started exploring templates, vm extesnion files
I want to create some more vm files and call it from "port_normal.vm"
How could I call this customized files from "portal_normal.vm"
Thanks
Joseph John
thumbnail
Samir Gami, geändert vor 12 Jahren.

RE: How to call another vm files from portal_normal.vm

Regular Member Beiträge: 162 Beitrittsdatum: 04.02.11 Neueste Beiträge
Hi John,

Velocity provide "#parse" to include other .vm file, like #parse( "MyVelocity.vm" )

If you search in portal_normal.vm file, it uses the #parsh to include other .vm files
For navigation : #parse ("$full_templates_path/navigation.vm")

#parse - Renders a local template that is parsed by Velocity
thumbnail
Joseph John, geändert vor 12 Jahren.

RE: How to call another vm files from portal_normal.vm

Junior Member Beiträge: 75 Beitrittsdatum: 26.07.11 Neueste Beiträge
Hi Samir
Thanks for the reply
#parse ("$full_templates_path/navigation.vm")

my vm file name is "my_login.vm" and I have created the file in the "template" directory where other vm files are kept, so I avoided giving the ""$full_templates_path"
I just called it from "portal_normal.vm" by entering
#parse ("my_login.vm")
Now I am getting the error when I run it, the error is
03:53:15,406 ERROR [velocity:151] #parse(): cannot find template 'my_login.vm', called at experiemt-theme_SERVLET_CONTEXT_/templates/portal_normal.vm[line 11, column 9]
03:53:15,407 ERROR [IncludeTag:231] Current URL / generates exception: Unable to find resource 'my_login.vm'
03:53:15,410 ERROR [IncludeTag:154] org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'my_login.vm'
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
thumbnail
Samir Gami, geändert vor 12 Jahren.

RE: How to call another vm files from portal_normal.vm (Antwort)

Regular Member Beiträge: 162 Beitrittsdatum: 04.02.11 Neueste Beiträge
We have to give relative path respect to servlet_context, so #parse ("$full_templates_path/my_login.vm") will work for you...
If you print the value for "$full_templates_path", you will get the idea emoticon
thumbnail
Joseph John, geändert vor 12 Jahren.

RE: How to call another vm files from portal_normal.vm

Junior Member Beiträge: 75 Beitrittsdatum: 26.07.11 Neueste Beiträge
Thanks
it is in "_SERVLET_CONTEXT_/templates"