JTableSection/check: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 63: | Line 63: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=check | category=check | ||
category=JTableSection | category=JTableSection | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:12, 25 March 2017
Description
Overloaded check function
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
check()
Returns
boolean
Defined in
libraries/joomla/database/table/section.php
Importing
jimport( 'joomla.database.table.section' );
Source Body
function check()
{
// check for valid name
if (trim( $this->title ) == '') {
$this->setError( JText::_( 'SECTION MUST HAVE A TITLE') );
return false;
}
// check for existing name
/*$query = "SELECT id"
. ' FROM #__sections "
. ' WHERE title = '. $this->_db->Quote($this->title)
. ' AND scope = ' . $this->_db->Quote($this->scope)
;
$this->_db->setQuery( $query );
$xid = intval( $this->_db->loadResult() );
if ($xid && $xid != intval( $this->id )) {
$this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Section') );
return false;
}*/
if(empty($this->alias)) {
$this->alias = $this->title;
}
$this->alias = JFilterOutput::stringURLSafe($this->alias);
if(trim(str_replace('-','',$this->alias)) == '') {
$datenow =& JFactory::getDate();
$this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
}
return true;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples