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.

Data Model Questions /

Control Dataobjects from other Page Types


Reply


1074 Views

Avatar
AlknicTeos

Community Member, 5 Posts

3 December 2009 at 5:33am

Edited: 03/12/2009 5:34am

Hello,

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

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

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 [url]http://silverstripe.org/all-other-modules/show/274300#post274300[/url] , 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 :)