示例#1
0
 /**
  * Returns seo title for current article (if oxTitle field is empty, oxArtnum is used).
  * Additionally - if oxVarSelect is set - title is appended with its value
  *
  * @param oxArticle $oArticle article object
  *
  * @return string
  */
 protected function _prepareArticleTitle($oArticle)
 {
     $sTitle = '';
     // create title part for uri
     if (!($sTitle = $oArticle->oxarticles__oxtitle->value)) {
         // taking parent article title
         if ($sParentId = $oArticle->oxarticles__oxparentid->value) {
             // looking in cache ..
             if (!isset(self::$_aTitleCache[$sParentId])) {
                 $oDb = oxDb::getDb();
                 $sQ = "select oxtitle from " . $oArticle->getViewName() . " where oxid = " . $oDb->quote($sParentId);
                 self::$_aTitleCache[$sParentId] = $oDb->getOne($sQ);
             }
             $sTitle = self::$_aTitleCache[$sParentId];
         }
     }
     // variant has varselect value
     if ($oArticle->oxarticles__oxvarselect->value) {
         $sTitle .= ($sTitle ? ' ' : '') . $oArticle->oxarticles__oxvarselect->value . ' ';
     } elseif (!$sTitle || $oArticle->oxarticles__oxparentid->value) {
         // in case nothing was found - looking for number
         $sTitle .= ($sTitle ? ' ' : '') . $oArticle->oxarticles__oxartnum->value;
     }
     return $this->_prepareTitle($sTitle, false, $oArticle->getLanguage()) . '.html';
 }