title: Create dynamic code with templates based on options
body: <p>I've a question related to dynamic code generation (html) with C# based on a template. The user sets all options (e.g. whether or not a <code>&lt;div&gt;</code> should be displayed, whether or not an image in the template should change by a specific date,...) and provides the content (text, images) needed for code generation. The generated code is needed for a WIFI hotspot site.</p>
  <p>The <strong>template</strong> consists of HTML, CSS and JavaScript which gets extended and modified by the user-defined settings at runtime. I also think of providing &quot;meta settings&quot; in the template to define, whether or not some options CAN be disabled set or not.</p>
  <p><strong>My major problem:</strong></p>
  <p>How to define the template to <em>dynamically extend</em> the template code easily? For example, if a user option is enabled at runtime, I'm in need to add JavaScript code on top and HTML code below another (specific) place. Another example is to hide content (a defined ) when another option is disabled...</p>
  <p>I'm not sure what's the best practice to handle that requirement. Maybe HTML elements with <code>id</code> attribute can help eliminate some of the problems. But with JavaScript I'm not sure. Maybe the template needs to be a XML which creates the final HTML at runtime? Any idea?</p>
  <p>Has anyone an idea how to handle that?</p>
  <p><strong>UPDATE/INFO:</strong></p>
  <p>The project is written in pure C# - without any ASP.NET. It is a desktop project working with HTML files and GENERATING HTML files (as an output).</p>