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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

VirtualPage doesn't pick up custom fields


Go to End


2 Posts   1967 Views

Avatar
NickJacobs

Community Member, 148 Posts

6 March 2009 at 4:56pm

Edited: 06/03/2009 5:01pm

I have a few double-up pages round the site I am working on so thought I had found the answer with the VirtualPage type (keeps the nav & breadcrumb etc intact)....but, I have quite a few different page types in the site and VirtualPage only picks up content and not the custom fields...

Has anyone found a workaround for this. ??

the proper page
the virtual page (video content not picked up)

Avatar
Helican

Community Member, 1 Post

15 April 2009 at 1:17am

Here's what I'm doing. Seems to work for me.

I have an Event page type, which can have any number of Artist pages as children, but I'm using virtual pages that point to Artist pages rather than actual Artist pages.

So I put this function into EventPage_Controller.

 function artistPages() {
	$children = $this->Children();
	$return = new DataObjectSet();
	foreach ($children as $key)
	{
		$virtualPage = DataObject::get_by_id('VirtualPage', $key->ID);
		$artistPage = DataObject::get_by_id('ArtistPage', $virtualPage->CopyContentFromID);
		$return->push($artistPage);         
	}      
	return $return;   
}

and then I put this into EventPage.ss

<% control artistPages %>
$ArtistName
$ArtistDescription
<% end_control %>