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.

General Questions /

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

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

Can't see Homepage.ss in dropdown menu


Go to End


8 Posts   1744 Views

Avatar
kevyn

Community Member, 6 Posts

12 August 2010 at 11:36pm

Edited: 12/08/2010 11:39pm

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,

Avatar
Willr

Forum Moderator, 5523 Posts

13 August 2010 at 4:01pm

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 {

}

Avatar
kevyn

Community Member, 6 Posts

13 August 2010 at 8:14pm

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 {
 
}
?>

Avatar
Willr

Forum Moderator, 5523 Posts

14 August 2010 at 9:13am

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!

Avatar
kevyn

Community Member, 6 Posts

16 August 2010 at 8:08pm

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?

Avatar
ttyl

Community Member, 114 Posts

18 August 2010 at 4:19am

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.

Avatar
kevyn

Community Member, 6 Posts

18 August 2010 at 10:52pm

Edited: 18/08/2010 11:24pm

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 ###

Avatar
donnaj8887

Community Member, 1 Post

20 August 2010 at 1:06pm

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

__________________
Watch The Switch Online Free