Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How to construct a Pier kernel
Last updated at 9:54 am UTC on 17 October 2008
Normally you add content to a Pier wiki through the web interface. There
are only very few things (probably none of which you care at the
beginning) that are not accessible from the web browser. [Source]

However it is possible to construct a wiki through code (for example through a model transformation). A PRKernel holds as a main object a root PRPage object. This root PRPage object has children.

The following example builds an initial model, creates a Pier kernel (PRKernel) object and makes it accessible at http://localhost:8080/seaside/mypier.

The initial model

MyPierModel :=  

(PRPage named: 'ThePageNameOfTheFirstPageOfMyWiki')
document: 
(PRDocument new 
			add: (PRParagraph new 
				add: (PRText content: 'some text');
				yourself);
			add: ((PRHeader new)
					level: 2;
					add: (PRText content: 'The heading level 2');
					yourself);
			add: (PRUnorderedList new
					add: (PRListItem new add: (PRText content: 'aaa'));
					add: (PRListItem new add: (PRText content: 'bbb'));
					add: (PRListItem new add: (PRText content: 'ccc'));
					yourself);
			add: (PRPreformatted new
				add: (PRText content: '   A line with 3 spaces');
				add: (PRText content: '	A line with a tab');
				yourself);	
		yourself
).



Create a Pier kernel on the model and register the application


PRPierFrame registerAsApplication: 'mypier' kernel: 
	(PRKernel named: 'mypierkernel' root: MyPierModel)



Access the application


http://localhost:8080/seaside/mypier


Environment

An environment object controls, how the PRPage objects are presented. Each PRPage object or a parent of it has an environment object associated with it. (see PRStructure). The environment object is as well a PRPage. As we do not contruct an environment object above, default values are created: see method PRStructure>>environment.

hjh