3093 Posts in 875 Topics by 654 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 146 Views |
-
show dataObjects as tabs in fronend

1 March 2013 at 1:50pm
Hello,
I have two data objects: one for Products, one for Features.I want to show them in front-end as two tabs in a Tabset. So I created a Form in my controller class
class Product_Controller extends Page_Controller{
public static $allowed_actions = array('myForm');public function myForm() {
// Create fields
$fields = new FieldList(
new TabSet(
$name = "TheTabSetName",
new Tab(
$title='Tab one',
new HeaderField("A header"),
new LiteralField("info from dataobject1.") // to keep it simple I replace the code with some place-holder texts
),
new Tab(
$title='Tab two',
new HeaderField("A second header"),
new LiteralField("info from dataobject2.")
))
);return new Form($this, 'myForm', $fields);
}
}And here it is my Product.ss file:
<div id="myform">
<h2>my form</h2>
$myForm
</div>
<div class="Content">But it doesn't show the form.
May I ask you what I'm doing wrong here?
The other question is should I use forms to show tabbed view in frontend?
Thank you.
| 146 Views | ||
|
Page:
1
|
Go to Top |

