API15

JModel/getTable: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 62: Line 62:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=getTable
  category=getTable
  category=JModel
  category=JModel
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:58, 25 March 2017

Description

Method to get a table object, load it if necessary.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

& getTable($name='', $prefix='Table', $options=array())
Parameter Name Default Value Description
$name The table name. Optional.
$prefix 'Table' The class prefix. Optional.
$options array() Configuration array for model. Optional.

Returns

object The table

Defined in

libraries/joomla/application/component/model.php

Importing

jimport( 'joomla.application.component.model' );

Source Body

function &getTable($name='', $prefix='Table', $options = array())
{
        if (empty($name)) {
                $name = $this->getName();
        }

        if($table = &$this->_createTable( $name, $prefix, $options ))  {
                return $table;
        }

        JError::raiseError( 0, 'Table ' . $name . ' not supported. File not found.' );
        $null = null;
return $null;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples