Developer forum

Forum » Development » does pageview object contains all html prerendered?

does pageview object contains all html prerendered?


Reply

    My question is pretty straight forward, i got a prerendering class, which worked prio v. 240 with just taking all the html before putting it in to Output.Text, however this is changed now.

 

atm i use: pvCtrl.Pageview.TemplatePage.Html

 

however it doesent seem to contain all html betwin <body> & </body> , is there any way to get all html prio render? Like in the good old days :)

 


Replies

 
Nicolai Høeg Pedersen
Reply
jed@dkis.dk wrote:

    My question is pretty straight forward, i got a prerendering class, which worked prio v. 240 with just taking all the html before putting it in to Output.Text, however this is changed now.

 

atm i use: pvCtrl.Pageview.TemplatePage.Html

 

however it doesent seem to contain all html betwin <body> & </body> , is there any way to get all html prio render? Like in the good old days :)

 


 

Hi Jais

 

You should be able to get it - where do you call it from?

 

In your Default.aspx codebehind you should have something like this:

 

Dynamicweb.Frontend.PageView Pageview = new Dynamicweb.Frontend.PageView();

Pageview.Load();

Dynamicweb.Frontend.PageviewControl pvCtrl = new Dynamicweb.Frontend.PageviewControl();
Output.Controls.Add(pvCtrl);
pvCtrl.Pageview = Pageview;
pvCtrl.ParseControls();

 

After Pageview.Load(); you should be able to do like this:

Pageview.TemplatePage.Html();

 

And after pvCtrl.Pageview = Pageview; you should be able to get it from pvCtrl.Pageview.TemplatePage.Html

 

What does it return? It should be the content of the pagetemplate used on the particular page.

 
Reply

Hey Nicloai,

I use the following code in default.aspx.cs

 

 

 

Pageview.Load();
Dynamicweb.Frontend.PageviewControl pvCtrl = new Dynamicweb.Frontend.PageviewControl();
Output.Controls.Add(pvCtrl);


//DanskInternetSelskab Handle XML Result hack
pvCtrl.Pageview.TemplatePage.Html = DanskInternetSelskab.Dw.SearchResultHandler.SearchResultHandler.HandleResult(pvCtrl.Pageview.TemplatePage.Html);

//DanskInternetSelskab Add Vestas Global Tags
pvCtrl.Pageview.TemplatePage.Html = DanskInternetSelskab.Dw.GlobalTags.HandleHtml(pvCtrl.Pageview.TemplatePage.Html);
           
//DanskInternetSelskab Clean HTML
pvCtrl.Pageview.TemplatePage.Html = DanskInternetSelskab.Dw.CleanCoder.HandleHtml(pvCtrl.Pageview.TemplatePage.Html);


pvCtrl.ParseControls();

 

 

i do get the html from the page template however i need all html prio render :)

 
Nicolai Høeg Pedersen
Reply
jed@dkis.dk wrote:

Hey Nicloai,

I use the following code in default.aspx.cs

 

 

 

Pageview.Load();
Dynamicweb.Frontend.PageviewControl pvCtrl = new Dynamicweb.Frontend.PageviewControl();
Output.Controls.Add(pvCtrl);


//DanskInternetSelskab Handle XML Result hack
pvCtrl.Pageview.TemplatePage.Html = DanskInternetSelskab.Dw.SearchResultHandler.SearchResultHandler.HandleResult(pvCtrl.Pageview.TemplatePage.Html);

//DanskInternetSelskab Add Vestas Global Tags
pvCtrl.Pageview.TemplatePage.Html = DanskInternetSelskab.Dw.GlobalTags.HandleHtml(pvCtrl.Pageview.TemplatePage.Html);
           
//DanskInternetSelskab Clean HTML
pvCtrl.Pageview.TemplatePage.Html = DanskInternetSelskab.Dw.CleanCoder.HandleHtml(pvCtrl.Pageview.TemplatePage.Html);


pvCtrl.ParseControls();

 

 

i do get the html from the page template however i need all html prio render :)


 

So - to understand you correctly, you want to get the parsed HTML? From good old days what comes from pv.load()?

Example:

temp = pageview.Output

//do some stuff on temp

Output.text = temp

 

Then there is a slight issue... This is how it works:

When pvCtrl.ParseControls(); is called, pageview.Output is called internally in the pageview control and the parsed html is handled in an internal variable which is not accessable.

 

So in other words - you cannot do it.

 

I've just commited a change to CVS so you would be able to do 2 things:

- A new notification called Notifications.Standard.Page.AfterOutput which will give you the Templatev2.Template object Dynamicweb uses to add global tags. Then you be able to add your own global tags or get the t.output from this object which will give you what you want.

- I've made the internal pageviewControl variable that holds pageview.output to a public property that can be accessed after pvCtrl.ParseControls();

 

So have to wait for this, or go back to "the old way". The difference is support for Usercontrols in templates.

 

 

 
Reply

Hey Nicolai, yes that was what i need'd...

 

And thanks for adding the options todo it the right way in the future.

 

In the meantime, i found out that i could override Render method of default.aspx and then take out all the cotent and string replace everything afterwards, abit of a machine killer, but works like a charm :)

 

 

//Jais

 

 

 
Nicolai Høeg Pedersen
Reply


 

Clever...

 

You must be logged in to post in the forum