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

Problem creating a new page type in Tutorial 1


Go to End


5 Posts   2167 Views

Avatar
Sammy

Community Member, 4 Posts

9 February 2009 at 7:43am

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" xml: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

Avatar
Nivanka

Community Member, 400 Posts

10 February 2009 at 7:21am

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

Avatar
Nivanka

Community Member, 400 Posts

10 February 2009 at 7:22am

also make the content in that to be just


<?php

?>

nothing much ;)

Avatar
Sammy

Community Member, 4 Posts

10 February 2009 at 7:46am

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 :)

Avatar
Capt. Morgan

Community Member, 30 Posts

16 February 2009 at 5:26am

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.