JModel/getTable: Difference between revisions
From Joomla! Documentation
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>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! 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"> | ||
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>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getTable | category=getTable | ||
category=JModel | category=JModel | ||
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