when i i write the following functions in \protected\models\User.php , " Property "User.seo" is not defined." error is occured.
i want to create , seo friendly url for , alllistings page with agency name., like users/alllistings/agency_name/
function :-
public function getLinkToAllListings($absolute = true)
{
if(issetModule('seo') && param('genFirendlyUrl')){
$seo = SeoFriendlyUrl::getForUrl($this->id, 'Apartment');
if($seo){
$field = 'url_'.Yii::app()->language;
return Yii::app()->createAbsoluteUrl('/apartments/main/alllistings', array(
'url' => $seo->$field . ( param('urlExtension') ? '.html' : '' ),
));
}
}
return Yii::app()->createAbsoluteUrl('/apartments/main/alllistings', array(
//'name' => $this->agency_name,
'id' => $this->id,
));
*/
if (issetModule('seo')) {
return $this->getRelationUrl1($absolute);
} else {
return self::getUrlById1($this->id, $absolute);
}
}
public function getRelationUrl1($absolute = true)
{
$method = $absolute ? 'createAbsoluteUrl' : 'createUrl';
if (issetModule('seo')) {
$seo = $this->seo;
if ($this->seo) {
$field = 'url_' . Yii::app()->language;
return Yii::app()->{$method}('/apartments/main/alllistings', array(
'url' => $seo->$field . (param('urlExtension') ? '.html' : ''),
));
}
}
return Yii::app()->{$method}('/apartments/main/alllistings', array(
'id' => $this->id,
));
}