Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Tutorial 'Building a Basic Web Site' - database rebuild

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

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

Page: 1 2 3
Go to End
Author Topic: 9695 Views
  • hector-the-pudding
    Avatar
    Community Member
    6 Posts

    Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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.

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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

  • hector-the-pudding
    Avatar
    Community Member
    6 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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

  • hector-the-pudding
    Avatar
    Community Member
    6 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

    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?

  • hector-the-pudding
    Avatar
    Community Member
    6 Posts

    Re: Tutorial 'Building a Basic Web Site' - database rebuild Link to this post

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

    9695 Views
Page: 1 2 3
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.