Developer forum

Forum » Development » Globaltags

Reply

Hey

 

Is there any way to set a templatetags as globals, like the once that come from DW, that can be used througout the templates?

 

Preferably in the begining of the event flow. I would have thought that setting Tags in the PageTemplateExtender could have been used from templates within it.

 

So can this be done, otherwise is there a way just to overrule/override the "Page menu" navigation results within a PageView/page?

 

/René


Replies

 
Reply

Hi Rene,

 

I’m having the same problem, and therefore I have created a Feature request.

 

http://developer.dynamicweb.dk/Forum-17061.aspx?action=ShowThread&ThreadID=819

 

/Thomas

 
Reply

Hey Thomas,

 

Thanks, I have allthough found a workaround/hack, not exactly what I would call supported way to do what should be pretty straight forward with minor changes from DW in the standard, so I also would like to hear from DW, why they are not supporting the "Standard Page After Render" notification, as I only see the Page.Loaded and Page.Title types of subscription.

 

But here is the code, so you might be able to accomplish the same:

 

[Subscribe("DWN_STANDART_PAGE_AFTER_RENDER")]
public class GlobalMenu : NotificationSubscriber
{
    public override void OnNotify(string notification, object[] args)
    {
        base.OnNotify(notification, args);
        if (args.Length > 0)
        {
            Dynamicweb.Templatev2.Template globalTemplate = args[0] as Dynamicweb.Templatev2.Template;
            if (globalTemplate != null)
            {
                globalTemplate.SetTag("tagname", "my value");
            }
        }
    }
}

 

/René
 

Argh sorry for the changes to this post (copy/paste to this forum with formating just seems to be a bit strange to say the least).

 
Reply

Would be great with other hooks in pageview. In the meantime, the requested functionality could be obtained by working with the first template class version og the PageView object:

 

PageView.TemplatePage.SetTemplateValue("TagName", "Value");

 

 
Reply
Sorensen wrote:

Would be great with other hooks in pageview. In the meantime, the requested functionality could be obtained by working with the first template class version og the PageView object:

 

PageView.TemplatePage.SetTemplateValue("TagName", "Value");

 

Hi Sorensen
 

I don't understand your answer can you give an example where you set a value to a global tag on default.aspx.cs file in a DW solution?

 

You must be logged in to post in the forum