User Login    
 + Register
  • Main navigation
Login
Username:

Password:


Lost Password?

Register now!
Documentation
Who's Online
146 user(s) are online (6 user(s) are browsing XoopsWiki)

Members: 5
Guests: 141

damaster, brentw, korafa, Cptrmaker, GPboarder, more...
[Main Page]

Dev:XoopsObjectHandler

From XOOPS Project

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy
Category: Development

Definition

XoopsObjectHandler(Database $db )

Most Important Methods

   create() - creates a new object
   get() - get object from database
   insert() - save object in database (either insert or update)
   delete() - delete object in database


Usage

Instead of instantiating your objects directly, the idea is to use the ObjectHandler instead. An object is created (new object - it can still come from the database or be an entirely new object) with this code:

   $class_handler =& xoops_gethandler('classname'); //NOT classnameHandler
   $thisobject =& $class_handler->get($objectid);


This is for an existing object in the database. For a new object, use this:

   $class_handler =& xoops_gethandler('classname'); //NOT classnameHandler
   $thisobject =& $class_handler->create();

This is for core classes. Module classhandlers should be fetched with

   $class_handler =& xoops_getmodulehandler('classname', 'dirname'); //NOT classnameHandler


The classHandler class should be in a file called classname.php placed in the modules/modulename/class directory. E.g. if the Story module has an Article class, extending XoopsObject, the class should be placed in a file called modules/story/class/article.php with the handler class in the same file and called StoryArticleHandler, extending XoopsObjectHandler and retrieved with xoops_getmodulehandler('article', 'story'). You do not need to include the php file yourself, if it follows the naming convention.

Back to Main Page

Retrieved from "http://www.xoops.org/modules/mediawiki/index.php/Dev:XoopsObjectHandler"

This page has been accessed 461 times. This page was last modified 01:48, 16 December 2007. Content is available under XOOPS Project.


Local Support Sites
Powered by
XOOPS Code hosted on SourceForge

Powered by PHP



Powered by MySQL

Powered by Smarty

OSI certified

All content on this site is subject to the Creative Commons License
Developers for Hire