Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay custom module content using html templates with custom tokensDisplay custom module content using html templates with custom tokens
Previous
 
Next
New Post
5/13/2014 3:51 PM
 

Good day.

I have seen many commercial modules making use of a theme type display of the contents where the actual contents gets displayed via html templates that the end-user can select themselves.

This is pretty cool as different layouts of the same contents can then be selected by the user. In addition to that additional layouts and maintenance of the display formats seems to be the way to go..

The html layouts typically have some div's with styling and tokens that gets replaced run-time.

Can anyone give me some sample code or assistance in documentation on how best to achieve this?
As an example the  http://www.easydnnsolutions.com/Modules/EasyDNNnews/Overview these guys do it like that..

Thank you.

 
New Post
5/14/2014 4:52 AM
 
DNN comes with a feature called "TokenReplace", which allows to replace predefined system, website, user, page and module tokens at runtime. This schema is extensible by modules for internal use, check out FormAndList, how to implement custom tokens.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
5/14/2014 12:52 PM
 

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
5/14/2014 1:52 PM
 
Are you looking because you are building a custom module? I do this frequently by loading in a template file (or could be from a database/modulesettings as well) and just doing string replaces.

var theOrder = ctx.Orders.SingleOrDefault(item => item.OrderId == intOrderID);

strTemplateEmail = readFile("/DesktopModules/ModuleName/templates/email.txt", false);
strTemplateEmail = strTemplateEmail
.Replace("[OrderID]", theOrder.OrderId.ToString())
.Replace("[First]", theOrder.FirstName)
.Replace("[Last]", theOrder.LastName)
.Replace("[Company]", theOrder.Company)
.Replace("[Email]", theOrder.Email)
.Replace("[Address1]", theOrder.Address1)
.Replace("[Address2]", theOrder.Address2)
.Replace("[City]", theOrder.City)
.Replace("[Postal]", theOrder.Zip)
.Replace("[DETAILS]", strEmailDetails);

Not sure if this was what you were looking for.
 
New Post
5/14/2014 2:49 PM
 

Thanks for all the help. Let me be a bit more specific.

I am developing custom modules, making use of Christopher Hammond's template using DAL2.
Typically we have a view.ascx that displays the module output.
The output might be a list of user submissions (just user data) in a repeating list.
I would like the output to be displayed by the view.ascx using html documents (templates). The template will have tokens representing my user submitted data. I.e. [dateOfSubmission].

I am comfortable to do replacement of tokens both my own and DNN built in, just need to understand how I accomplish the display of a custom html template as output in my view.ascx. I believe Sebastian understands my requirement best at this point... just have to go through the code that he suggested. It looks like xslt is used there... would prefer HTML.

Sooo using Christopher's dnn module development strategy and providing "Theme's" as a dropdown in the module settings for the user to choose on of several themes, which then renders the output based on that "theme". In this case a theme would typically be a separate folder containing the html template and some resources like images, css etc.

Thank you.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay custom module content using html templates with custom tokensDisplay custom module content using html templates with custom tokens


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out