Actions

API15

JTableCategory/check

From Joomla! Documentation

< API15:JTableCategory
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

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/category.php

Importing

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

Source Body

function check()
{
        // check for valid name
        if (trim( $this->title ) == '') {
                $this->setError(JText::sprintf( 'must contain a title', JText::_( 'Category') ));
                return false;
        }
 
        // check for existing name
        /*$query = 'SELECT id'
        . ' FROM #__categories '
        . ' WHERE title = '.$this->_db->Quote($this->title)
        . ' AND section = '.$this->_db->Quote($this->section)
        ;
        $this->_db->setQuery( $query );
 
        $xid = intval( $this->_db->loadResult() );
        if ($xid && $xid != intval( $this->id )) {
                $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Category') );
                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

<CodeExamplesForm />