JModel/ construct: Difference between revisions
From Joomla! Documentation
No edit summary |
m removing red link to edit, no existant pages |
||
| 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=== | ||
| Line 65: | Line 65: | ||
<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=== | ||
| Line 80: | Line 80: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Revision as of 18:36, 12 May 2013
Description
Constructor
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
__construct($config=array())
| Parameter Name | Default Value | Description |
|---|---|---|
| $config | array() |
Defined in
libraries/joomla/application/component/model.php
Importing
jimport( 'joomla.application.component.model' );
Source Body
function __construct($config = array())
{
//set the view name
if (empty( $this->_name ))
{
if (array_key_exists('name', $config)) {
$this->_name = $config['name'];
} else {
$this->_name = $this->getName();
}
}
//set the model state
if (array_key_exists('state', $config)) {
$this->_state = $config['state'];
} else {
$this->_state = new JObject();
}
//set the model dbo
if (array_key_exists('dbo', $config)) {
$this->_db = $config['dbo'];
} else {
$this->_db = &JFactory::getDBO();
}
// set the default view search path
if (array_key_exists('table_path', $config)) {
$this->addTablePath($config['table_path']);
} else if (defined( 'JPATH_COMPONENT_ADMINISTRATOR' )){
$this->addTablePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />