Jump to:

1347 Posts in 439 Topics by 514 members

Themes

SilverStripe Forums » Themes » Home.ss not showing?

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 1005 Views
  • Bambii7
    Avatar
    Community Member
    254 Posts

    Home.ss not showing? Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Home.ss not showing? Link to this post

    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 {

    }

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Home.ss not showing? Link to this post

    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);
       }
    }

    1005 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.