1
votes

Hello everyone, today i'm trying to create a one page site with SilverStripe. i created a HomePage where i put all my pages so i have

HomePage
    Page1
    Page2
    Page3

In my HomePage layout, i loop to display my others pages content like this

<% loop Children %> 
    <div class="$URLSegment"> 
        $renderWith($ClassName) 
    </div> 
<% end_loop %>

I wanted some text items in my first page so i created them and created the appropriate function in my Page1.php like this

public function getTextItems(){
    return $this->TextItems();
} 

...And i thought the text items would appear by calling the function in my layout. It's actually my problem, nothing appears in my layout if i try to call some object from my children pages. Does anybody know if there is a way i can make this running? Or maybe it's not the best way to do a one page...so if you have some hints, comon :)

Thanks! Thomas

1

1 Answers

2
votes

Usually for simple one-page sites I put everthing into the HomePage, without looping over its childrens. Anyway, I think your problem is that getTextItems() is defined into the Controller, while looping over Children() will extract just the Models.

Furthermore have a look to this quite new module, I just see it a few days ago (but never tested it):

http://addons.silverstripe.org/add-ons/wernerkrauss/silverstripe-onepage