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.

General Questions /

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

Having trouble getting subsites working with 2.4


Go to End
Reply


14 Posts   4856 Views

Avatar
TF-35Lightning

Community Member, 137 Posts

21 April 2010 at 12:59am

Hi all,

I'm having some difficulty getting the subsites module to work on 2.4, could someone please point me to what I am doing wrong. I've followed the doc, copied the modules directory to my project root and renamed it to subsites, did the dev/build/?flush=1 loaded the admin but I don't see anything in there related to subsites (refeshed browser also). Noticing after I renamed the modules directory to subsite that there was also 1 child directory also called subsites I removed one of these directories and tried the build again, but this time I see errors relating to subsites. (my first build I actually didnt see anything related to subsites)

Any help would be great

Avatar
Willr

Forum Moderator, 5513 Posts

24 April 2010 at 7:58pm

but this time I see errors relating to subsites.

Could you post the error message if you are still encountering it?

Avatar
TF-35Lightning

Community Member, 137 Posts

24 April 2010 at 9:30pm

I've just read that generic dataadmin Module which is now the ModelAdmin is a requirement.

I'm a bit confused do I have to run through this entire page http://doc.silverstripe.org/doku.php?id=modeladmin

before I install subsites?

Avatar
TF-35Lightning

Community Member, 137 Posts

29 April 2010 at 5:45pm

Guys I'm not entirely sure if I am naming the directories correclty.

On http://doc.silverstripe.org/modules:subsites it says: If you don't have subversion, you can download a ZIP file and copy the modules/subsites/trunk folder into your project folder, and rename it to subsites.

Ok so I take it that means the directory path should change from "modules/subsites/trunk" to "/subsites" which is what I do, I do the dev rebuild and can see subsites is being added to the DB but then when I access the site I get Fatal error: Call to a member function canView() on a non-object in F:\wamp\www\silverstripe\silverstripe-v2.4.0-beta1\sapphire\core\model\SiteTree.php on line 756.

If someone could let me know if I am doing that correctly would be great.

Avatar
TF-35Lightning

Community Member, 137 Posts

29 April 2010 at 9:19pm

Edited: 29/04/2010 9:21pm

Apparantly the way I am renaming/chanign the path there is correct but I still get that error, not sure where to go now???

/subsites is in the root of my project, and you can access codes, css, docs etc et etc underneath /subsites

Avatar
TF-35Lightning

Community Member, 137 Posts

3 May 2010 at 6:51pm

Edited: 03/05/2010 7:19pm

willr and luke, for whatever reason subsites worked for me on "one" occasion on 2.4beta (when willr was going to help me step through it in the chat room) its just worked once only like magic, then went back to the error
Fatal error: Call to a member function canView() on a non-object in F:\wamp\www\mysite\sapphire\core\model\SiteTree.php on line 756
The one time it worked was straight after another installation of the DOM module, so I don't know wheather that helped it to work, but all the other times I was testing it I was not changing any files etc (a clean install) it just worked that one occassion like magic, very weird.

However I just downloaded 2.4rc2 and subsites works straight away for me now without error which is great, however I do not know the correct path to access my subsite on the front end, can you please show me???

I have setup a subsite called "subsite1". My root silverstripe installation is located at:
http://localhost/silverstripe/silverstripe-v2.4.0-rc2/

I was just thinking the subsite would be accessed from:
http://localhost/silverstripe/silverstripe-v2.4.0-rc2/subsite1/
or
http://subsite1.localhost/silverstripe/silverstripe-v2.4.0-rc2/ etc but I get "Page not found error"

If someone can show me what the path would be would be great, don't seem to be able to really see this info on the subsites doc page in relation to the localhost etc

Avatar
TF-35Lightning

Community Member, 137 Posts

4 May 2010 at 6:39pm

Edited: 05/05/2010 1:16am

Ok I have now correctly configured my Virtual Hosts (well I think its correct, it might not be) on WAMP and now can access my silvers stripe site via:

http://mysilvestripe

I however can not access my subsites subdomain or access subsites at all on the front end. My subsite is called subsite1

when I go to

http://subsite1.mysilvestripe

I get

Oops! Google Chrome could not find subsite1

Now reading through the subsite docs, it says to edit mysite/config and add in a Subsite::set_allowed_domains(array( with the allowed domains. I do that but then I get Notice: Subsite::set_allowed_domains() is deprecated; it is no longer necessary because users can now enter any domain name in F:\wamp\www\silverstripe\silverstripe-v2.4.0-rc2\subsites\code\Subsite.php on line 79

Here is what I have done with my Virtual hosts (maybe I have done this incorrect??? I also tried giving subsite1.mysilverstripe its own <VirtualHost> code chunk, but it gives the same response as this one below which is when you request http://subsite1.mysilverstripe it simply goes to the orginal silverstripe site which I thought it would and does not go to the page I have created under the subsite. (I don't have to create a specific home or index page for it to pick up do it?)

Heres the Virtual Host setup

hosts file

127.0.0.1 mysilverstripe
127.0.0.1 localhost
::1 localhost

httpd-vhosts.conf file

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "f:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "f:/wamp/www/silverstripe/silverstripe-v2.4.0-rc2"
ServerName mysilverstripe
   ServerAlias subsite1.mysilverstripe
ErrorLog "logs/mysilverstripe.log"
CustomLog "logs/mysilverstripe.log" common
#<directory "f:/wamp/www/silverstripe/silverstripe-v2.4.0-rc2">
# Options Indexes FollowSymLinks
# AllowOverride all
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#</directory>

</VirtualHost>

just hoping someone can please show me what I need to do to be able to access my subsite1!

PS. I notice also that the screenshots on the subsite doc page isn't the same as what I am getting.
http://doc.silverstripe.org/_detail/modules:subsites-module-adminscreenshot-new.png?id=modules:subsites

Heres my screen shot:
http://www.flickr.com/photos/42659897@N08/4577730109/sizes/l/

Notice there are no links to the subsites in the bottom left (I presume if you click on those they would take you to the front end subsite)

Avatar
bennylope

Community Member, 12 Posts

5 May 2010 at 1:52am

tf22raptor, I added my working example to this thread: http://www.silverstripe.org/all-other-modules/show/266003?start=0#post283612

I had to jury rig a solution using the .htaccess file to provide a hardcoded URL parameter of SubsiteID based on the HTTP_HOST.

I've seen several instances in which someone s/he got the Subsites module working and accessible from the front end, but I've yet to see a single one of them adequately describe their configuration.

Go to Top