Developer forum

Forum » Templates » Is there a (better) way to include pages - with their respective templates - in another template

Is there a (better) way to include pages - with their respective templates - in another template

Hans Ravnsfjall
Hans Ravnsfjall
Reply

What I have so far, is:

      @Dynamicweb.Frontend.PageView.GetPageviewByPageID(36).Output()

But there are potential issues with this. Eg. if the pageid doesn´t exist, it seems the system crashes totally. Also, if i set the content type of the included page (GetPageviewByPageID), it appears that applies fot the whole page being loaded. So if I eg. set the content type to plaintaxt on the included page (to get rid of DW comments etc.) - the whole page is outputted as plain text

So, is there any better way to include a page with its belonging template, in another template?

/Hans


Replies

 
Nicolai Pedersen
Reply

Hi Hans

That is not a good idea... That could cause some serious issues and endless loops that would kill the webserver.

I am not sure you can - and not sure you should! There is a method called @RenderPageContent(36) - but that renders only the paragraphs from that page and not globals.

So what are you trying to achieve? Maybe there is a better way.

BR Nicolai

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Nicolai

thx for the reply

Ok, if this renders the paragraphs on the page, with its belonging templates - then that is exactly what I am looking for

will try that.

 

/Hans

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Guess I was too fast, problem of course is that I can´t get this structure imported without some hacky unuserfriendly solution (as part of that comes from the pagetemplate)

<div class="container">
     <div class="col-3">
         (Flexible number of different paragraphs)
     </div>
     <div class="col-3">
         (Flexible number of different paragraphs)
     </div>
     <div class="col-3">
         (Flexible number of different paragraphs)
     </div>
     <div class="col-3">
         (Flexible number of different paragraphs)
     </div>
</div>

 

Anybody got any suggestions on how to solve this?

/Hans

 

You must be logged in to post in the forum