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.

Archive /

Our old forums are still available as a read-only archive.

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

Tutorial 'Building a Basic Web Site' - database rebuild


Go to End
Reply


17 Posts   10074 Views

Avatar
hector-the-pudding

Community Member, 6 Posts

2 August 2008 at 12:48pm

In the tutorial 'Building a Basic Site', under the Homepage Template section, it suggests rebuilding the database using the URL http://localhost:3000/db/build?flush=1

OK, I'm running a MAMP installation on Mac OSX and need to change the port to 8888.

But I just get a 'Not found on this server' message. The db directory has sub-directories for mysql and sqlite. But nor does http://localhost:8888/db/mysql/build?flush=1 work, either.

I have no idea how to build the database and hence populate it with the tables it apparently needs for the new template page type.

Stuck!!

Can someone be a bit more specific about where the "build" address is? i can't see any file called 'build' anywhere....??

thx.

Avatar
BLU42 Media

Community Member, 71 Posts

3 August 2008 at 2:51am

Hi-

I'm also using MAMP with OSX for testing. The port change to 8888 is no problem at all - you'll just need to change the address that you're attempting the rebuild. You don't need to include mysql in the address:

http://localhost:8888/db/build?flush=1

John

Avatar
Willr

Forum Moderator, 5513 Posts

3 August 2008 at 4:13pm

If you have installed SS into a folder within your servers directory then you will need to have that in the url as well. For example if you keep your MAMP sites under Sites/ and you have created a folder called 'SilverStripe' in the sites folder then you need to visit http://localhost:8888/SilverStripe/db/build?flush=1

Avatar
hector-the-pudding

Community Member, 6 Posts

4 August 2008 at 11:35am

Thanks smartplugs and willr.

Will, your method worked...I just needed to direct it to the 'ss' folder under htdocs! OK, I didn't have my head screwed on but then I'm not very techie.

Unfortunately, although the database build appears to have happened, no new pagetype shows up in the behaviour list.

:(

Stuck again....

Bless her soul, I don't think my mum would have got very far with this!

H.

Avatar
Willr

Forum Moderator, 5513 Posts

4 August 2008 at 12:02pm

have you created the PHP code file in the correct place? which is a) in the tutorial/code/ folder if you installed silverstripe with the tutorial option or b) mysite/code/ folder if you installed with the black candy option.

Also make sure that your file name matches the class name inside the file (eg for an ArticlePage page type your file needs to be called ArticlePage.php and have this inside it

<?php

class ArticlePage extends Page {}

static $db = array();

class ArticlePage_Controller extends Page_Controller {}

?>

And last but not least (after you have made sure you have built the database) make sure that you refresh the CMS so that the dropdown menu can reload the options by going http://localhost:8888/ss/admin?flush=1

Avatar
hector-the-pudding

Community Member, 6 Posts

4 August 2008 at 12:46pm

In answer to your points...

1. Yes, file HomePage.php created inside tutorials/code

2. Just copied and pasted what it said to copy in the tutorial to make the file!...because that's what it said do!!! I do notice that it has the class HomePage. My file in /code is called HomePage.php, and content is thus:

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

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

}

class HomePage_Controller extends Page_Controller {
   
}
?>

3. Yes, refreshed the CMS admin several times, logged out, logged back in etc. etc.

H.

Avatar
Willr

Forum Moderator, 5513 Posts

4 August 2008 at 3:18pm

Strange. Im out of ideas as to what could be the cause then. Try copying that file to mysite/code/ and run db/build?flush=1 - does anything happen?

Avatar
hector-the-pudding

Community Member, 6 Posts

6 August 2008 at 12:48pm

Edited: 06/08/2008 12:48pm

Copied the HomePage.php file to mysite/code and then did a db rebuild with flush.

Nothing other than the normal whirrings and grinding of the machine!...certainly no change in admin - no Home Page option yet available in Behaviour tab. Mac has been shut down and restarted several times and the MAMP server along with it.

Looks like HomePage is not an option for me :(

A pity, I wanted to get into this...

Go to Top