Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Problem creating a new page type in Tutorial 1

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: 1128 Views
  • Sammy
    Avatar
    Community Member
    4 Posts

    Problem creating a new page type in Tutorial 1 Link to this post

    Hi!

    I have read a lot of Forum posts about this problem and tried all of the proposed solutions but I still havent been able to solve my problem. I have installed SilverStripe-v2.2.3 in the folder htdocs on my macbook pro running Mac OS X 10.5 with MAMP installed. During installation I chosed the tutorial option and i have created tutorial/code/HomePage.php

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

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

    }

    class HomePage_Controller extends Page_Controller {
       function init() {
       parent::init();
    }
    ?>

    and tutorial/templates/HomePage.ss

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" >
       <head>
          <% base_tag %>
          <link rel="stylesheet" type="text/css" href="tutorial/css/layout.css" />
          <link rel="stylesheet" type="text/css" href="tutorial/css/typography.css" />
          <link rel="stylesheet" type="text/css" href="tutorial/css/form.css" />
       </head>
       <body>
          <div id="Main">
             <div id="Header">
                <h1>&nbsp;</h1>
             </div>
             <div id="ContentContainer">
                <div id="Content" class="typography">
                   $Content
                   $Form
                </div>
             </div>
             <div id="Footer">
                <span>Visit <a href="http://www.silverstripe.com" title="Visit www.silverstripe.com">www.silverstripe.com</a>; to download the CMS</span>
             </div>
          </div>
          $SilverStripeNavigator
       </body>
    </html>

    and then i ran http://localhost:8888/SilverStripe-v2.2.3/db/build?flush=1 and http://localhost:8888/SilverStripe-v2.2.3/admin/?flush=1 in browser (FF) and now i can't find HomePage as a page type in the Admin-window. I have tried to move _config.php, HomePage.ss and HomePage.php to the mysite-folder and changed the $project to mysite in _config.php whith no success.

    When I do the http://localhost:8888/SilverStripe-v2.2.3/db/build?flush=1 the result is

    Building Database

    Creating database tables
    # Newsletter
    # Newsletter_SentRecipient
    # Newsletter_Recipient
    # NewsletterType
    # PageComment
    # Email_BounceRecord
    # Email_BlackList
    # PageView
    # SiteTree
    # QueuedEmail
    # File
    # EditableCheckboxOption
    # EditableDropdownOption
    # EditableFormField
    # EditableRadioOption
    # SubmittedForm
    # SubmittedFormField
    # Group
    # Member
    # Member_UnsubscribeRecord
    # Permission
    # Widget
    # WidgetArea
    # GhostPage
    # Page
    # UserDefinedForm
    # ErrorPage
    # RedirectorPage
    # VirtualPage
    # SubscribeForm
    # Image
    # Folder
    # Image_Cached
    # EditableCheckbox
    # EditableCheckboxGroupField
    # EditableDateField
    # EditableDropdown
    # EditableEmailField
    # EditableFileField
    # EditableFormHeading
    # EditableMemberListField
    # EditableRadioField
    # EditableTextField
    # SubmittedFileField
    # Group_Unsecure

    Creating database records
    # Newsletter
    # Newsletter_SentRecipient
    # Newsletter_Recipient
    # NewsletterType
    # PageComment
    # Email_BounceRecord
    # Email_BlackList
    # PageView
    # SiteTree
    # QueuedEmail
    # File
    # EditableCheckboxOption
    # EditableDropdownOption
    # EditableFormField
    # EditableRadioOption
    # SubmittedForm
    # SubmittedFormField
    # Group
    # Member
    # Member_UnsubscribeRecord
    # Permission
    # Widget
    # WidgetArea
    # GhostPage
    # Page
    # UserDefinedForm
    # ErrorPage
    # RedirectorPage
    # VirtualPage
    # SubscribeForm
    # Image
    # Folder
    # Image_Cached
    # EditableCheckbox
    # EditableCheckboxGroupField
    # EditableDateField
    # EditableDropdown
    # EditableEmailField
    # EditableFileField
    # EditableFormHeading
    # EditableMemberListField
    # EditableRadioField
    # EditableTextField
    # SubmittedFileField
    # Group_Unsecure

    All in black text. I guess there is some problem with the database not getting updated or something like that. I hope there is someone out there who can help me with this problem. I like the SS admin interface and I would love to start using it, but if I don't get this problem solved I have to use another CMS.

    /Sammy

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Problem creating a new page type in Tutorial 1 Link to this post

    create a file called _config.php and put it in the tutorial folder, it will solve I guess.

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: Problem creating a new page type in Tutorial 1 Link to this post

    also make the content in that to be just

    <?php

    ?>

    nothing much ;)

  • Sammy
    Avatar
    Community Member
    4 Posts

    Re: Problem creating a new page type in Tutorial 1 Link to this post

    I have a _config.php in the tutorial folder

    <?php

    global $project;
    $project = 'tutorial';

    global $databaseConfig;
    $databaseConfig = array(
       "type" => "MySQLDatabase",
       "server" => "localhost",
       "username" => "root",
       "password" => "root",
       "database" => "SS_mysite",
    );

    // Sites running on the following servers will be
    // run in development mode. See
    // http://doc.silverstripe.com/doku.php?id=devmode
    // for a description of what dev mode does.
    Director::set_dev_servers(array(
       'localhost',
       '127.0.0.1',
    ));

    ?>

    I tryed to make the content in that to be just

    <?php

    ?>

    with no success.. Thanks for trying anyway

  • Capt. Morgan
    Avatar
    Community Member
    30 Posts

    Re: Problem creating a new page type in Tutorial 1 Link to this post

    Thank you. That _config.php somehow solved it for me. I'm getting a warning for the Page class ocurring both in tutorial and in MySite folders. But my database got updated with my new pagetype.

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