API:getKeywords

From MODx Wiki
Jump to: navigation, search
File: manager/includes/document.parser.class.inc.php
Line: 1648
function getKeywords($id= 0) {
        if ($id == 0) {
            $id= $this->documentObject['id'];
        }
        $tblKeywords= $this->getFullTableName('site_keywords');
        $tblKeywordXref= $this->getFullTableName('keyword_xref');
        $sql= "SELECT keywords.keyword FROM " . $tblKeywords . " AS keywords INNER JOIN " . $tblKeywordXref . " AS xref ON keywords.id=xref.keyword_id WHERE xref.content_id = '$id'";
        $result= $this->dbQuery($sql);
        $limit= $this->recordCount($result);
        $keywords= array ();
        if ($limit > 0) {
            for ($i= 0; $i < $limit; $i++) {
                $row= $this->fetchRow($result);
                $keywords[]= $row['keyword'];
            }
        }
        return $keywords;
    }
Personal tools