Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


To create (or if exists update) a category in Joomla via PHP…

    $cat = JTable::getInstance('category');
    if ($cat->id==null) {
    	echo "Create Category<br>";
    	$cat->title='Blacklist for';
    	if (!$cat->check()) { 
    		JError::raiseNotice(500, $cat->getError());
    		 echo "Category Check failed<br>";
    	} else {
    		if (!$cat->store(TRUE)) { 
    			JError::raiseNotice(500, $cat->getError()); 
    			echo "Category Create Failed<br>";
    		} else {
    			echo "Category Created<br>";
    } else {
    	echo "Update Category<br>";

Richard 2019/03/21 11:22

/data/webs/external/dokuwiki/data/pages/joomla/create_or_edit_a_category_in_php.txt · Last modified: 2019/05/20 09:03 by genadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki