Click here to Skip to main content
15,892,161 members
Articles / Web Development / ASP.NET

Template merging with NVelocity and ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.62/5 (31 votes)
24 Aug 2007CPOL7 min read 211.6K   4.1K   80  
A tutorial about merging templates with NVelocity and ASP.NET.
using System.Collections;
using NVelocity;
using NVelocity.App;
using NVelocity.Context;

namespace NVelocityTemplateEngine.BaseClasses
{
	/// <summary>
	/// Summary description for NVelocityEngineBase.
	/// </summary>
	public abstract class NVelocityEngineBase : VelocityEngine
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="NVelocityEngineBase"/> class.
		/// </summary>
		/// <param name="cacheTemplate">if set to <c>true</c> [cache template].</param>
		protected NVelocityEngineBase(bool cacheTemplate) : base()
		{
			this.SetProperty("assembly.resource.loader.cache", cacheTemplate.ToString().ToLower() );
		}

		/// <summary>
		/// Creates a VelocityContext from an IDictionary object.
		/// </summary>
		/// <param name="context">The context.</param>
		/// <returns></returns>
		protected static IContext CreateContext(IDictionary context)
		{
			return new VelocityContext(new Hashtable(context));
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions