5514 Posts in 1733 Topics by 1219 members
|Go to End|
4 May 2012 at 3:35pm
I need a little help please.
i am trying to display a template page in a tab in the cms and populate it with data from a dataobject,
so far ...
i have created the dataobject, and using modeladmin have setup the tabs to fill out the formdata, and have added a tab with a literalfield that calls a template to display the result. it seems to ignore the control blocks and the $fielddata tags.
and to complicate matters their are several dropdowns that get thier data from several dataobjects.
this page works perfectly in the frontend, however some users will only work in the cms side and need to see the finished form without having to go into the front.
Hope this makes sense
5 May 2012 at 11:36pm Last edited: 5 May 2012 11:43pm
After A long day of searching and pondering and sore eyes i managed to work this out
Here is what i have done.
if($ViewPage = DataObject::get('DataObject'))
return $this -> customise(new ArrayData(array())) -> renderWith('ViewPage');
// CMS fields
$fields->addFieldToTab('Root.TabName', new LiteralField('Data View', $this->getData()));
This Will Render a Page from a Template into a tab in your dataobject in the cms and populate it with the data from that object.
Note: The template needs to be put into mysite/templates folder and if you create an includes folder the includes should work aswell.
Hope this helps someone in the future
|Go to Top|