Class PageTemplateExtender
- Namespace
- Dynamicweb.Frontend
- Assembly
- Dynamicweb.dll
Pageview template extender. Extends the rendering of a PageView.
public abstract class PageTemplateExtender : TemplateExtender
- Inheritance
-
PageTemplateExtender
- Derived
- Inherited Members
Examples
using Dynamicweb.Frontend;
namespace Dynamicweb.Examples
{
public class PageTemplateExtenderSample : PageTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Rendering.Template template)
{
template.SetTag("MyTag", "MyValue");
//Find the page in the master language and loop its language versions
var myHomePage = Dynamicweb.Content.Services.Pages.GetPage(1);
foreach(var languageVersionsOfHomePage in myHomePage.Languages)
{
//If one of the language versions of the page matches the current area, use the id and name for a link or something.
if(languageVersionsOfHomePage.AreaId == Dynamicweb.Frontend.PageView.Current().AreaID)
{
var name = languageVersionsOfHomePage.MenuText;
var id = languageVersionsOfHomePage.ID;
}
}
//Using navigation tags, see http://doc.dynamicweb.com/documentation-9/content/content/pages#3241, to get a language context based page
var myLanguageContextHomePage = Dynamicweb.Content.Services.Pages.GetPageByNavigationTag(PageView.Current().AreaID, "MyHomePage");
}
}
}
Properties
PageView
Gets or sets the PageView instance.
public PageView PageView { get; set; }
Property Value
- PageView
The pageview.