tmp/test-doxy-mms/MarekMailSystem/MarekMailSystem2/TemplateEngine.cs

Go to the documentation of this file.
00001 using System;
00002 using System.IO;
00003 using System.Collections;
00004 using System.Collections.Generic;
00005 using System.Text;
00006 using NVelocity;
00007 using NVelocity.App;
00008 using NVelocity.Context;
00009 
00010 namespace MarekMailSystem2
00011 {
00012     public class TemplateEngine : VelocityEngine
00013     {
00014         public TemplateEngine(bool cacheTemplate)
00015             : base()
00016         {
00017             this.SetProperty("assembly.resource.loader.cache", cacheTemplate.ToString().ToLower());
00018             this.Init();
00019             
00020         }
00021 
00022 
00023         public string Process(Dictionary<string, string> context, string template)
00024         {
00025             if (template == null) return null;
00026             if (template == "") return "";
00027             StringWriter writer = new StringWriter();
00028             this.Evaluate(new VelocityContext(new Hashtable(context)), writer, "mystring", template);
00029             // TODO: co to mystring????
00030             return writer.ToString();
00031 
00032             //TODO: Seba kiedys stwierdzil ze to jest zle (chociaz dziala :P)
00033             //i podal mi cos takiego:
00034 //Sprobuj takiej konstrukcji:
00035 //using NVelocity;
00036 //using NVelocityTemplateEngine;
00037 //(...)
00038 //NVelocityTemplateEngine.Interfaces.INVelocityEngine memoryEngine = NVelocityEngineFactory.CreateNVelocityMemoryEngine(true);
00039 //this.OutputHTML = memoryEngine.Process(this.contextObject, this.InputHTML);
00040 
00041             //TODO: doczytac i zrobic jak ma byc.
00042         }
00043     }
00044 }

Generated on Thu Oct 25 11:32:52 2007 for Marek Mail System by  doxygen 1.5.3-20071008