User Login    
 + Register
  • Main navigation
Login
Username:

Password:

Remember me



Lost Password?

Register now!
Who's Online
58 user(s) are online (9 user(s) are browsing XoopsWiki)

Members: 1
Guests: 57

nsluzewski, more...
[Main Page]

Dev:using xoops api

From XOOPS Project

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://www.xoops.org/modules/mediawiki/index.php/Dev:using_xoops_api"

This page has been accessed 896 times. This page was last modified 17:27, 15 December 2007. Content is available under XOOPS Project.


Developers for Hire
Developers for Hire
Local Support Sites
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


Powered by
XOOPS Code hosted on SourceForge

Powered by PHP

PHP 5

Powered by MySQL

Powered by Smarty

OSI certified

GPL

All content on this site is subject to the Creative Commons License
Top Tags
Theme (5) news (2) security (2) sport (1) Arabic (1) wiki (1) Christmas (1) jQuery (1) tag (1) module (1) SEO (1) comments (1)
Advertisement