Get XOOPS XOOPS FAQ Forums News Themes Modules

XOOPS vs. Herko Coomans

Make a donation

Please select an amount to donate


Do you want your username revealed with your donation?
Yes - List me as a Generous Donor
No - List my donation as from an Anonymous Donor


Search

Local Support Sites

Cumulus Tag Cloud

admin Arabic banner block Christmas comments cumulus DayDawn dhsoft e-Commerce E-Learning Google GUI hacks instant-zero jQuery module news Nordic Olédrion oxygen PageRank security SEO simple-XOOPS sport tag Theme wiki xoops

New Users

Registering user

# 97494

bradnelson6

Welcome to XOOPS!
XOOPS Code hosted on SourceForge
[Main Page]

Dev:XoopsObjectHandler

From XOOPS CMS (Content Management System)

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 1,499 times. This page was last modified 01:48, 16 December 2007. Content is available under XOOPS CMS (Content Management System).