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:

Data Model Questions /

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

Control Dataobjects from other Page Types

Go to End



Community Member, 5 Posts

3 December 2009 at 5:33am

Edited: 03/12/2009 5:34am


hopefully this is the right place for my Issue.

My plan is to show a Page on a Page. ^^ Let me explain.

On many "normal" Pages i would like to have a complete form ( like a Page from type : UserDefinedForm ), lets say left from the normal displayed page. Or Maybe a Imagegallery or or or.

My first thought was, hm lets make something like

        	<% control Page(herecouldstandyourpagename) %>
            	         $Content (... $Form,$UserdefinedForm...)       
                <% end_control %>

went through the code and found in UserDefinedForm.php at public function index

$content = str_ireplace('$UserDefinedForm', $form->forTemplate(), $this->Content);
				return array(
					'Content' => $content,
					'Form' => ""

made then a function in page.php, got the wanted dataobject byid and hoped ... of course he coundnt handle it (like $this->Form (made short view in function form and and and)

k, lets make the template-function yourself, but when i viewed the dataobject like print_r(Dataobject::get_by_id("Page",ID)); in page.php, i realized that i dont get the data for the form. Viewed in the UserDefinedForm page (print_r($this))i have seen then my Form Object with its EditableFields in [_object_cache:protected] array ... also not really know how do handle this.

Searched and found a similar task with imagegallery , but as i understand it, the big difference is, that i cant access the data ( what would be the $ThumbnailURL for the imagegallery more or less).

Sure, a simple form somewhere to make isnt a problem. But not only that Userform has nice features, i would have all my forms in one place. It would be really awesome if it would be easy to control the $content-data from another page type in another,somehow.... .

I hope, its clear what i wish.

Anyone has a Solution/Idea/Hints ?
First of all simple solutions will be favoured :)