21491 Posts in 5783 Topics by 2621 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1841 Views |
-
Access dataobjects from page in virtual page

26 August 2009 at 8:23am
Hi,
I defined a new dataobjects in my page controller (Image), which i display in pages with $BannerImage. Every normal page has its own image.
However, this does't work on virtual pages; there doesn't seem to be a image there. Of course i want to use the image defined for the normal page used by the virtual page.
How can I access the dataobjects from the original page in a virtual page?
-
Re: Access dataobjects from page in virtual page

27 August 2009 at 12:28am
Nobody any idea? This can't be so hard..
-
Re: Access dataobjects from page in virtual page

7 October 2009 at 10:42pm
I think it might be because the data object is defined in the "Page" pagetype, whereas this is a "virtual page" type.
I'm having a similar problem with a user defined form.
-
Re: Access dataobjects from page in virtual page

30 December 2009 at 8:40am
I've come up with a bit of hack to get some functionality Custom Functionality. Unfortunately the Virtual Page uses the Page Template Class by default.
If you add the Following to your VirtualPage.php you can get some better rendering control:
function index() { // index runs if no other function is being called - it is like a second init()
$realPage = $this->ContentSource()->ClassName;
if($realPage != "Page") {
return $this->renderWith("Virtual".$realPage);
}
else {
return Array();
}
}You need to then create a root template with the name Virtual(Original Page Class). Unfortunately this all but eliminates some of the modularity the template system provides. In this template then wrap anything that calls Custom Data with
<% control ContentSource %> <% end_control %>
This will let you access all the custom Data from the Original Pagetype.I still haven't figured out a way to enable Custom Forms and Functions beyond copying to the VirtualPage type and modifying their calls to use the ContentSource Method
| 1841 Views | ||
|
Page:
1
|
Go to Top |



