Developer forum

Forum » Feature requests » Global template tag extender

Global template tag extender


Reply

 

I need a GlobalTemplateTagExtender fore the SetGlobalTemplateTag method in the PageView class.

 

Or a possibility to add custom global templatetags to the PageView before the SetGlobalTemplateTags is executed.

Example (From the CustomModules Page_Load):

 

Dynamicweb.Frontend.PageviewControl pvCtrl = new Dynamicweb.Frontend.PageviewControl();

Output.Controls.Add(pvCtrl);

 

//New feature

Pageview.GlobalTagCollection.Add("CustomGlobalTag:1",strGlobalTag1);

Pageview.GlobalTagCollection.Add("CustomGlobalTag:2",strGlobalTag2);

 

pvCtrl.Pageview = Pageview;

pvCtrl.ParseControls();

 


Replies

 
Reply

There are a number of ways in which I think you can acheive that effect:

 

PageView.TemplatePage.SetTemplateValue("Tag", "Value");
PageView.TemplateMaster.SetTemplateValue("Tag", "Value");


Within a PageTemplateExtender:

 

Template.SetTag("Tag", "Value");

 

I wrote this article where you might find some useful information about this issue:

 

http://developer.dynamicweb.dk/Weblog-16918.aspx?action=ShowArticle&ArticleID=148

 
Reply

 

Please correct me if I’m wrong, but your examples only have affect on tags in the master and page template file. Tags in paragraph and module templates files, will not bee reached with this?

 
Reply

Yup, they should also be parsed. At least, it works for me;)
 

 
Reply


Nope, In my test it only render Template tags placed in the master or the page templates.

 

Tags from other modules are not rendered.

 

So can you please post your customer module code?

 
Reply

The code is available for download in the article mentioned above, so you can get it there. Feel free to send your code to me, and I'll have a look at it.

 
Reply
Sorensen wrote:

The code is available for download in the article mentioned above, so you can get it there. Feel free to send your code to me, and I'll have a look at it.


Ahh... Now it works.

 

In the PageTemplateExtender i place the code:

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

 

And not as you wrote:

Template.SetTag("Tag", "Value");

 

 
Reply

Oh, my mistake. I hadn't noticed that. But if you read the article, you got it right.

 

The thing is, that the old template enging takes over, when TemplateV2 has completed its processing of the page content, so at that time we can process these "dynamic" tags on the content that has already been processed.