API15

JTableSection/check

From Joomla! Documentation

< API15:JTableSection

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Overloaded check function

[<! removed edit link to red link >]

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

Syntax[edit]

check()


Returns[edit]

boolean

Defined in[edit]

libraries/joomla/database/table/section.php

Importing[edit]

jimport( 'joomla.database.table.section' );

Source Body[edit]

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[edit]

Code Examples[edit]