Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Virtual Page to custom page

Go to End

2 Posts   4157 Views


Community Member, 7 Posts

8 February 2008 at 11:32am

I have a page that has various additional fields set in addition to the main "Content" one. Also, it uses a different template.

How can I get my VirtualPage to use a different template from the standard (shouldn't it grab the template from the target page anyway?) and use the additional fields?



Community Member, 126 Posts

24 April 2008 at 10:34pm

had the same problem, couldn't find a function for this so here is my workaround:

say 'ProjectHolder' has 'VirtualPage' children pointing to some 'ProjectPage'. every 'ProjectPage' has a field 'Date', aside from the content, i want to show on my 'ProjectHolder' page:

in ProjectHolder_Controller:

function projectPages() {
  $children = $this->Children();
  $return = new DataObjectSet();
  for ($i = 0; $i < $children->TotalItems(); $i++) {
    $virtualPage = DataObject::get_by_id("VirtualPage", $children->Current()->ID);
    $projectPage = DataObject::get_by_id("ProjectPage", $virtualPage->CopyContentFromID);
  return $return;	  


<% control projectPages %>
  Project Date: $Date
  Project Content: $Content
<% end_control %>