load
- Ariadne >
- Library >
- Ariadne 2.6 >
- Manuals >
- Programmers Reference >
- Classes >
- Object >
- PINP Methods >
(void) load($class)
Loads a module definition for use in an object template.
| Argument | Description |
|---|---|
| (string) $class | The name of the module to load. |
load() loads the
specified module or class from the modules directory in Ariadne. This directory
contains a number of extension modules which implement additional functionality,
not always needed. One of these modules, for example, is the DB module,
which allows access to a large number of relational databases using SQL. It is
based on the PEAR DB module, so you must have that installed for it to work.
Here's an example of how it works:
<pinp>
load("mod_db.php");
$db=DB::connect("mysql://user@localhost/database");
if (!DB::isError($db)) {
$db->setFetchMode(DB_FETCHMODE_OBJECT);
$query="select * from MyTable";
$result=$db->query($query);
if (DB::isError($result)) {
echo DB::errorMessage($result);
$continue=false;
} else {
// do something with the results
}
} else {
// there was an error connecting...
}
</pinp>
See the documentation for PEAR DB, at the pear.php.net website for more information.

