Hi there,
Is there a way to create custom global tags that are also accessible in menu XSLT files? I am trying to render some custom stuff that I need to use in an XSLT file and in other locations, but I don't know how. Tried it as a PageTemplateExtender but didn't see the results show up in the XSLT file....
Thanks in advance,
Imar
Developer forum
E-mail notifications
Create Custom Global Tags
Posted on 12/11/2010 16:55:14
Replies
Posted on 14/11/2010 18:23:23
I don't think it is possible.
When an XML menu is generated, tags are added from Pageview.GetGlobalTags()
GetGlobalTags does not include any custom global tags.
Pageview.Output() has this notification...
NotificationManager.Notify("DWN_STANDART_PAGE_AFTER_RENDER", new object[] { globalTemplate });
If DW would just create a similar notification inside GetGlobalTemplateTags, then our global tags would be available as XML in XML menu templates and any other XSLT template.
Nicolai Høeg Pedersen
Posted on 15/11/2010 11:14:34
You can use Notifications.Standard.Page.AfterOutput to make your own global tags - except for in navigation.
Just made the XmlDocument property public so it can be manipulated through navigation providers.
Also made a Notifications.Standard.Page.OnGlobalTags notification that can be used to add your own global tags - also for xmlnavigation.
Out with 7.2
Just made the XmlDocument property public so it can be manipulated through navigation providers.
Also made a Notifications.Standard.Page.OnGlobalTags notification that can be used to add your own global tags - also for xmlnavigation.
Out with 7.2
Rene Poulsen
Posted on 19/01/2012 15:52:33
How does this actually work, Nicolai? I'm trying to create my own global tags (in DW8). I'm Subscribing to the Standard.Page.AfterOutput, casting my args as Standard.Page.AfterOutputArgs. On these args there is a template object on which you can call the SetTag method, but it doesn't seem to work.
I've tried to use the OnGlobalTags notification, but there is no OnGlobalTagsArgs. If this is what i need to do, what should i cast the Args as?
Thanks in advance,
René
I've tried to use the OnGlobalTags notification, but there is no OnGlobalTagsArgs. If this is what i need to do, what should i cast the Args as?
Thanks in advance,
René
Rene Poulsen
Posted on 19/01/2012 16:00:31
Sorry, of course it's working. I looked for the tag by writing out DwTemplateTags but the notification happens (as the name indicates) after the output is generated. So the tag won't show up in the tag list when using DwTemplateTags, but I can use it anyway :-)
Nicolai Høeg Pedersen
Posted on 19/01/2012 16:03:03
Hi Rene
Can be tricky...
But use the OnGlobalTags notification with Notifications.Standard.Page.PageviewNotificationArgs. It has a template property where you can set global tags. And then they should also appear in DwTemplateTags.
BR Nicolai
Can be tricky...
But use the OnGlobalTags notification with Notifications.Standard.Page.PageviewNotificationArgs. It has a template property where you can set global tags. And then they should also appear in DwTemplateTags.
BR Nicolai
Nicolai Høeg Pedersen
Posted on 19/01/2012 16:04:09
A sample:
[Extensibility.Subscribe(Dynamicweb.Notifications.Standard.Page.OnGlobalTags)] public class PageviewObserver : Dynamicweb.Extensibility.NotificationSubscriber { public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args) { if (args == null) return; Dynamicweb.Notifications.Standard.Page.PageviewNotificationArgs pna = (Dynamicweb.Notifications.Standard.Page.PageviewNotificationArgs)args; //To do - insert your code here } }
Rene Poulsen
Posted on 11/05/2012 09:49:15
Perfect! Thank you Nicolai!
You must be logged in to post in the forum