List Info

Thread: Re: shared templates




Re: shared templates
user name
2008-03-26 23:18:53
Hi,

Yes I solved this with pretty much the same solution below.  
I created a velocity template say - common.vm in which i put the things like pictures or links which I need to be universal - i.e present throughout the site, no matter what template/theme .. even if admin console..
In the velocitydispatcher.java file I placed the following code in the dispatch method:

          ;          velocityEngine.mergeTemplate("common.vm", BlojsomConstants.UTF8, velocityContext, responseWriter);
and commented out velocityEngine.mergeTemplate(flavorTemplateForPage, BlojsomConstants.UTF8, velocityContext, responseWriter);

Also, common.vm MUST have the code :

#if($BLOJSOM_FLAVOR_TEMPLATE_FOR_PAGE)
   ; #parse("$BLOJSOM_FLAVOR_TEMPLATE_FOR_PAGE")
#else
  ;  #parse("$BLOJSOM_FLAVOR_TEMPLATE")
#end 

otherwise your templates will not render.

Place this common.vm in WEB-INFtemplates

If you don't want to hardcode "common.vm" you could put it in a properties file.

And for getting a war file after compilation use the build.xml which is in the source but please see what target you are using with ant build. I build in eclipse itself where i set the targets. The default target is "compile" so maybe that gives you some jars but there is a target called "war" as well.

Open build.xml in eclipse, right click on it and choose External Tools. You will get a dialogue box.Click on the targets tab and choose your targets.

Regards,
Shalini

 



starcut.com">Lakshmi.Suryakumarstarcut.com wrote:
schki.starcut.com" type="cite">
Hi,
                Did you figure out how we can use the same templates for
all the blogs instead of creating templates seperately for eah blog.i saw
ur post below.please let me know how you solved this.also how do i merge
blojsom to another application.i have downloaded the source but when i
compile i get only jar file unlike the war.how can i integrate this blojsom
to my existing site.

                                                                           
                                                                           
                                                                           
                                                                           
   [Blojsom-developers] non-editable portion to templates                  
   From: Shalini gm..."><;shaliny.igm...> - 2007-12-13 12:09                      
   Hi all,                                                                 
                                                                           
   I was wondering, is there a way to have a part of the templates that is 
                                                                           
   not editable by the end user. I thought of this :                       
   To have a vm file in a directory which is not part of the theme         
   directory. And then have a parse() call to it in a regular theme        
   template like asual.vm.                                                 
   But i want a better alternative because i want this non-editable        
   portion                                                                 
   to be absolutely untouchable by the end user, and in this option he can 
                                                                           
   remove the parse call altogether.                                       
                                                                           
   I looked at the Velocity Dispatcher code. I feel maybe something can be 
                                                                           
   done there.                                                             
                                                                           
   Any help is appreciated.                                                
                                                                           
   Thanks a tonne!                                                       
                                                                           
                                                                           




Thanks And Regards,

Lakshmi Suryakumar,
Starcut Asia Pacific Pte Ltd,
3,International Business Park,
02-27,Nordic European Centre,
Singapore 609927

"A man is not finished when he's defeated; he's finished when he quits."








  

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )