Developer forum

Forum » CMS - Standard features » DwTemplateTags

DwTemplateTags

Thomas Schroll
Reply

Hi

In a normal html template you get all module tags when using DwTemplateTags inside a loop. Is there any way to accomplish that when using a razor template? If not, is there another way to get the list og templatetags?

Regards Thomas

 

 


Replies

 
Morten Bengtson
Reply

See https://github.com/dynamicweb/razor/wiki/webinar

 

 
Thomas Schroll
Reply

Thanks Morten.

It seems a bit more difficult to use. Are there any plans for a more 'designer friendly' approach?

Regards Thomas

 

 

 
Morten Bengtson
Reply

Here is another example - but it probably isn't designer friendly either :)

 

 

I have made a few helper functions that can be included and used in other Razor templates. It renders some tables with the tag names and values.

 

 

You can use it like this...

@inherits RazorTemplateBase<RazorTemplateModel<Template>>
@using System;
@using System.Linq;
@using Dynamicweb.Rendering;

<!--@Include(Debug.cshtml)-->

<div>
    <h1>Using helper functions to display available values</h1>
    
    <!-- Most tags can be rendered using the good old DwTemplateTags -->
    <!--@DwTemplateTags-->

    <!-- Render all basic values (normal template tags) -->
    @ShowValues()
    
    <!-- Render all values available in specific loops. You can specify a path to render values of a nested loop. -->
    @ShowLoopValues("Products","Products/AssociatedGroups")
    
    <!-- Render specific global values -->
    @ShowGlobalValues("Global:Page.ID", "Global:Page.Name")
</div>

I have attached the files Debug.cshtml (where the helpers are defined) and ProductList.cshtml (the example above).

Note: The nested loops part requires DW 8.3.0.5 or later

 

 
Mikkel Ricky
Reply

Nice work, Morten.

We've been playing around with something similar using Razor helpers and functions, but it may also make sense to build some inspection/debugging functions into Dynamicweb Razor, i.e. in a dll. What do you prefer?

This should be combined with IntelliSense on which I see you've made some progress as well (cf. http://developer.dynamicweb-cms.com/forum/templates/make-visual-studio-recognize-dw-methodes.aspx) to give a cool and easy to work with environment.

Please, suggest any helpers and methods you like to see here or on the Dynamicweb Razor wiki page Razor like DwTemplateTags.

Best regards,
Mikkel

 

 

 

 

 

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

What about implementing a tab for Glimpse with the relevant data? A bit like what Pavel did with the script plugin: http://getglimpse.com/Help/Custom-Tabs

 

Imar

 

 
Scott Forsyth
Reply

How about "all of the above"? :)

Glimpse support would be awesome. I've seen a few CMS providers tap into Glimpse already. But sometimes it's also nice to just add something like @DwTemplateTags and have it show all objects without scope.

Glimpse support is less intrusive on the page but more to setup initially, so both have their value in different situations.

Scott

 
Klavs Martens
Reply

 

We are already working on Glimpse integration and custom tabs implementation for the things you would normally get by using debug=true. Other possible custom tabs we might implement is eCommerce basket and maybe caching and logging. We also hope to hook into the Glimpse Timeline, but the Glimpse API's are still poor when it comes to anything else than custom tabs. 

We plan to support Glimpse when we upgrade to the newest .NET framework.

Klavs Martens
Dynamicweb


 

 

 

 

You must be logged in to post in the forum