Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Can't see Homepage.ss in dropdown menu

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1189 Views
  • kevyn
    Avatar
    Community Member
    6 Posts

    Can't see Homepage.ss in dropdown menu Link to this post

    Hi there,

    New to silverstripe, and have just followed through the tutorial, but when I get to the last part on tutorial1, I create the HomePage.ss file, but I can't see the option in the dropdown menu for my homepage

    Is there something else I need to be doing?

    I've tried adding flus to the end of my admin panel like so, but it still doesn't show:
    http://mydomain.com/index.php/admin?flush=1

    thanks,

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    Hi kevyn,

    Welcome to the forums. Note you need a HomePage.php more importantly. Not just a SS file. Make sure you have a HomePage.php file with at least

    <?php

    class HomePage extends Page {

    }

    class HomePage_Controller extends Page_Controller {

    }

  • kevyn
    Avatar
    Community Member
    6 Posts

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    Thanks Willr, I've added the HomePage.php file, however I still can't see homepage in the dropdown menu.

    I've tried doing this part: "We can do this by going to http://localhost/dev/build?flush=1. "

    but I'm having no luck, when I try this I get a 404 because I don't have a dev folder in the root. I do have a dev folder here: /sapphire/dev/build?flush=1 but that also doesn't do anything because I don't have a file called build.

    I'm feeling a little lost! any help would be much appreciated

    my homepage php contains the exact text from the tutorial:

    <?php
    /**
    * Defines the HomePage page type
    */

    class HomePage extends Page {
    static $db = array(
    );
    static $has_one = array(
    );

    }

    class HomePage_Controller extends Page_Controller {

    }
    ?>

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    You don't need a directory called 'dev'. SilverStripe uses URL Rewriters to translate those 'nice' urls into actual classes and methods. I think the issue is here is you do not have mod_rewrite enabled since your admin link looks like

    http://mydomain.com/index.php/admin?flush=1

    Note the index.php part. This tells you that mod_rewrite isn't working as otherwise you would have http://mydomain.com/admin. So when you see a URL used in the documentation like dev/build this will have to come *after* the index.php line like

    http://mydomain.com/index.php/dev/build?flush=1

    Hope that makes sense!

  • kevyn
    Avatar
    Community Member
    6 Posts

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    Well this is what I thought, however my host tells me that mod_rewrite is enabled, and showed me a screenshot to prove that it is enabled, so I don't know what is going on

    Would mod_rewrite stop my homepage.ss from being shown in the dropdown menu though?

  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    In order for a page to show up in your drop down it has to be 'built' first - hence the need to run /dev/build. Every time you add a new file you need to run a build.

    I think you should shake out the issues you are having with mod_rewrite and you will be good-to-go.

  • kevyn
    Avatar
    Community Member
    6 Posts

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    Hi again - I've just dealt with my webhost (webhostuk.uk.net) who have been awesome, and fixed the problem for me.

    they say that the problem was with my htaccess file not being correct, and they took the one from the SS directory and replaced mine, and now all seems to be ok.

    I'm not sure if this is something that should happen automatically or not, and they say that mod_rewrite is always enabled by default on their servers, so I'm not sure if the problem was with the SS install or something I did wrong.

    But basically, replacing the htaccess file with the one in the SS directory solved the URL rewriting, and enabled me to do the dev/flush which has let me view my other page templates

    now to get stuck into silverstripe!

    edit: here is what my htaccess file now looks like

    ### SILVERSTRIPE START ###
    <Files *.ss>
       Order deny,allow
       Deny from all
       Allow from 127.0.0.1
    </Files>

    <Files web.config>
       Order deny,allow
       Deny from all
    </Files>

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{REQUEST_URI} ^(.*)$
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
    </IfModule>
    ### SILVERSTRIPE END ###

  • donnaj8887
    Avatar
    Community Member
    1 Post

    Re: Can't see Homepage.ss in dropdown menu Link to this post

    Thanks you for the post.
    Hi guys, Im a newbie. Nice to join this forum.

    __________________
    Watch The Switch Online Free

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