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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

Home.ss not showing?


Go to End


3 Posts   1664 Views

Avatar
Bambii7

Community Member, 254 Posts

1 July 2010 at 11:14pm

Hi all,
very strange behavior happening here. I must be doing something wrong but I can't see what.

I made a home page class just so I could template the home page.
I made Home.php
class Home extends Page {

static $add_action = 'Home Page';

}
then Home.ss (which is now sitting in mysite/templates/Home.ss and themes/mytheme/Home.ss and also the Layout folders)
"test"

But after I save and publish, ?flush=1, ?flush=all I still get the class name "Home" and thats all thats printing.

Any ideas? :P

Avatar
Willr

Forum Moderator, 5523 Posts

2 July 2010 at 4:47pm

Do you have a controller for that class?? All page types must have a model and a controller. For example in your case

<?php

class Home extends Page {

}

class Home_Controller extends Page_Controller {

}

Avatar
Bambii7

Community Member, 254 Posts

2 July 2010 at 4:56pm

True! Thanks willr I forgot about adding the controller, its been too long since I used SS.

I was having the same issue with a tag page before I did a test with the home page. Does the following look complete? TagPage.ss should work ya

class TagPage extends Page {

static $add_action = 'Tag Page';

public function Tags() {
return DataObject::get('TagDataObject');
}

}

class TagPage_Controler extends Page_Controller {
static $url_handlers = array(
'tag/$Action/$ID/$Name' => 'order'
);

function order($a) {
print_r($a);
}
}