Developer forum

Forum » Templates » Render page content in DW9.19

Render page content in DW9.19

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,
I am trying to export some pages (blog articles), including the HTML markup.
I know that I can export using RenderGrid for pages based on the Visual editor, but I also have some pages that are not based on the Visual editor.
To make things even worse, the pages are basedon the old Rapido DynamicArticle layout.

Now, is there any method in this new API that would allow me to render the page content using a specific template?

Thank you,
Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Anybody?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Adrian

You can try this:

using (PageViewIsolation pvIso = new PageViewIsolation(intPageID, false, true))
{
    PageView PageView = PageView.Current();
    PageView.Redirect = false;
    PageView.IsEmailContext = true;
    PageView.Context = pageviewContext;

    if (!string.IsNullOrEmpty(template))
    {
        //TODO: Why something this old in something that new....
        //Dim tm As New Dynamicweb.Frontend.Templates()
        //tm.TemplateFile = template
        //PageView.Template = tm
    }

    return PageView.Output();
}

Then you got the page. Then if you only want part of the page, you can use some regex magic to clip that parts you want.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Great!

I will try it out and come back with a status.
Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,
It does not seem to work. There is a missing pageviewContext, which I need for each page I want to render, and a PageView.Template only supports "get" without "set".
I will find another solution.

Thank you,
Adrian

 

 

You must be logged in to post in the forum