Jump to:

3450 Posts in 1063 Topics by 738 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Control Dataobjects from other Page Types

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

Page: 1
Go to End
Author Topic: 1027 Views
  • AlknicTeos
    Avatar
    Community Member
    5 Posts

    Control Dataobjects from other Page Types Link to this post

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

    1027 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.