DpObject DpObject
CREATING DUTCHPIPE OBJECTS
Introduction
Making an object
IntroductionDpObject.php is the most important building block when you're
making DutchPIPE enabled sites within the framework.
In the end, every object in your DutchPIPE universe inherits
the DpObject class. Most objects you'll make don't use DpObject
directly but use classes built on top of DpObject, for example
DpPage.
Making an objectYou can construct a DutchPIPE object in two ways:
From the code of another object, by making a new instance of
DpObject and calling methods in it to set it up. For
simple objects, this is all that is needed. For example:
. 'DpObject.php');
$ob->addId('flower', 'purple flower');
$ob->setTitle('purple flower');
. 'flower_body.jpg" width="190" height="216" border="0" alt="" '
. 'align="left" style="margin-right: 15px; border: solid 1px black" />It '
. 'is the purple white flower of the Dutchman\'s Pipe.');
By making a custom class that extends on DpObject.
dpuniverse/obj/note.php
{
{
$this->addId('note', 'paper note', 'small note', 'small paper note',
'small, paper note', 'a small note');
$this->setBody('This is a small paper note. You can read it.<br />');
$this->addAction('read me!', 'read', 'actionRead');
}
etc.
}
The class name should be the same as the filename, with the first
letter capitalized.
Note that because of PHP namespace limitations, currently the
classname must be unique in your universe. We plan on supporting
auto-class names.
There are various methods you can call (like setTitle) or define
(like createDpPage) which will be discussed next.
|
|