Your browser must have JavaScript enabled in order to view this page.
 
Welcome Guest#1758 Login/register    Go to Bottom
Go to Top
 > DpUniverse   Introduction >
DpObject

DpObject

CREATING DUTCHPIPE OBJECTS

 > Introduction
 > Making an object

Introduction

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

You can construct a DutchPIPE object in two ways:

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

    1.     . 'DpObject.php');
    2. $ob->addId('flower''purple flower');
    3. $ob->setTitle('purple flower');
    4. $ob->setTitleImg(DPUNIVERSE_IMAGE_URL 'flower.gif');
    5. $ob->setBody('<img src="' DPUNIVERSE_IMAGE_URL
    6.     . 'flower_body.jpg" width="190" height="216" border="0" alt="" '
    7.     . 'align="left" style="margin-right: 15px; border: solid 1px black" />It '
    8.     . 'is the purple white flower of the Dutchman\'s Pipe.');
  2. By making a custom class that extends on DpObject.

    dpuniverse/obj/note.php

    1. inherit(DPUNIVERSE_STD_PATH 'DpObject.php');
    2.  
    3. final class Note extends DpObject
    4. {
    5.     public function createDpObject()
    6.     {
    7.         $this->setTitle('small note');
    8.         $this->setTitleImg(DPUNIVERSE_IMAGE_URL 'smallnote.gif');
    9.         $this->addId('note''paper note''small note''small paper note',
    10.             'small, paper note''a small note');
    11.         $this->setBody('This is a small paper note. You can read it.<br />');
    12.  
    13.         $this->addAction('read me!''read''actionRead');
    14.     }
    15.     etc.
    16. }

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.


 > DpUniverse   Introduction >

Documentation generated on Mon, 03 Sep 2007 22:17:49 +0200 by phpDocumentor 1.3.0RC6

Click me!
Guest#1758
 
 
 
  Go to Top
 
 
Input Field OptionsClose Input Field Go to Top
 
Legal Notices | Copyright © 2006, 2007 Lennert Stock. All rights reserved. Last update: Mon Sep 03 2007, 21:50 CET.