API15

JModel/getTable: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Method to get a table object, load it if necessary. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JModel/getTable|Edit Descripton...
 
m preparing for archive only
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JModel/getTable|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JModel/getTable}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
<source lang="php">getTable($name='', $prefix='Table', $options=array())</source>
<source lang="php">& getTable($name='', $prefix='Table', $options=array())</source>


  {| class="wikitable"
  {| class="wikitable"
Line 40: Line 40:
===Source Body===
===Source Body===
<source lang="php">
<source lang="php">
public function getTable($name='', $prefix='Table', $options = array())
function &getTable($name='', $prefix='Table', $options = array())
{
{
         if (empty($name)) {
         if (empty($name)) {
Line 46: Line 46:
         }
         }


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


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


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JModel/getTable|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JModel/getTable}}
<! removed transcluded page call, red link never existed >


===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=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

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