Joomla 查询 - Select 来自发布状态的内容

Joomla query - Select from content where state is published

我需要显示类别 id = 43 的所有已发布的 joomla 文章。我的查询:

<?php
    $catId = 43;
    $state = 1;
    $query = "SELECT * FROM #__content WHERE catid ='" . $catId . "' order by title asc";
    $db = JFactory::getDBO();
    $db->setQuery($query); 
    $articles = $db->loadObjectList(); 
    foreach($articles as $article) {
        echo 'Content';
    }
?>

添加状态条件:

 $query = "SELECT * FROM #__content WHERE catid ='" . $catId . "' and state = 1 order by title asc";