Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules

Search

Donate to XOOPS!

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


Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

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

New Users

Registering user

# 133946

HamptonUdolf

Welcome to XOOPS!
[Main Page]

Dev:using xoops api

From XOOPS Web Application System

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

Printable version | Disclaimers | Privacy policy
Category: Development

Using Xoops API

In addition to the Xoops API documentation http://www.xoops.org/misc/api/ here we also need guidelines for module writers as to what classes to use when, why, and how, etc. For example:

   * XoopsObject Data Access classes

If you create a module class (in the class folder of your module) called <Module>MyClass that extends XoopsObject:

    include_once XOOPS_ROOT_PATH."/class/xoopsobject.php";
    class ModuleMyClass extends XoopsObject
    {
    /**
    * Constructor
    **/
    function ModuleMyClass() // Constructor
    {
    $this->initVar('my_variable', XOBJ_DTYPE_INT, NULL);
    }
    }

and a handler called <Module>MyClassHandler that extends XoopsObjectHandler:

   class ModuleMyClassHandler extends XoopsObjectHandler
   {
   }

you can then obtain a refereance to an instance the handler class like so:

In /modules/module/index.php:

   $myclasshandler = &xoops_getmodulehandler('MyClass');

Built in data object handlers can be obtained via xoops_gethandler('<class>').

Search for the use of this idiom in other modules for an idea of how these classes let you build data access objects to interface with corresponding database tables.

Also see these wiki pages: XoopsObject | XoopsObjectHandler


Back to the Main Page

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

This page has been accessed 3,396 times. This page was last modified 17:27, 15 December 2007. Content is available under XOOPS Web Application System.