00001 <?php
00002
00006 class Content extends oxUBase
00007 {
00012 protected $_sContentId = null;
00013
00018 protected $_oContent = null;
00019
00024 protected $_sThisTemplate = 'content.tpl';
00025
00031 public function init()
00032 {
00033 if ( oxUtils::getInstance()->seoIsActive() ) {
00034
00035 $this->setSessionCategoryId( null );
00036 }
00037
00038 parent::init();
00039 }
00040
00046 public function getViewId()
00047 {
00048 if ( isset( $this->_sViewId ) ) {
00049 return $this->_sViewId;
00050 }
00051 return $this->_sViewId = parent::getViewId().'|'.oxConfig::getParameter( 'tpl' );
00052 }
00053
00064 public function render()
00065 {
00066 parent::render();
00067
00068 $this->_aViewData['tpl'] = $this->getContentId();
00069 $this->_aViewData['oContent'] = $this->getContent();
00070
00071
00072 $this->setMetaDescription( $this->getContent()->oxcontents__oxtitle->value, 200, true );
00073 $this->setMetaKeywords( $this->getContent()->oxcontents__oxtitle->value );
00074
00075 return $this->_sThisTemplate;
00076 }
00077
00083 protected function _getSeoObjectId()
00084 {
00085 return oxConfig::getParameter( 'tpl' );
00086 }
00087
00093 public function getContentId()
00094 {
00095 if ( $this->_oContentId === null ) {
00096 $this->_oContentId = false;
00097 $sContentId = oxConfig::getParameter( 'tpl' );
00098 $oContent = oxNew( 'oxcontent' );
00099 if ( $oContent->load( $sContentId ) && $oContent->oxcontents__oxactive->value ) {
00100 $this->_oContentId = $sContentId;
00101 $this->_oContent = $oContent;
00102 }
00103 }
00104 return $this->_oContentId;
00105 }
00106
00112 public function getContent()
00113 {
00114 if ( $this->_oContent === null ) {
00115 $this->_oContent = false;
00116 if ( $this->getContentId() ) {
00117 return $this->_oContent;
00118 }
00119 }
00120 return $this->_oContent;
00121 }
00122
00129 protected function getSubject()
00130 {
00131 return $this->getContent();
00132 }
00133
00134 }