Присадка к плагину "Ручные URL"
Данное изменение позволяет убрать из URL параметр blog, т.е. изменить url вида netlanc.net/blog/25.html или netlanc.net/blog/plagin-ruchnye-url.html в netlanc.net/plagin-ruchnye-url/
открываем \plugins\mainurl\classes\modules\topic\entity\Topic.entity.class.php и меняем содержимое функции public function getUrl() { на
активируем плагин, сбрасываем кеши.
открываем \plugins\mainurl\classes\modules\topic\entity\Topic.entity.class.php и меняем содержимое функции public function getUrl() { на
if($this->getMainUrl()){
$sUrl = $this->getMainUrl();
$sRreturn = Config::Get('path.root.web').'/'.$sUrl.'/';
} else {
$sUrl = $this->getId();
if ($this->getBlog()->getType()=='personal') {
$sRreturn = Router::GetPath('blog').$this->getBlog()->getUrl().$sUrl.'.html';
} else {
$sRreturn = Router::GetPath('blog').$this->getBlog()->getUrl().'/'.$sUrl.'.html';
}
}
return $sRreturn;
далее открываем \plugins\mainurl\classes\hooks\HookMainurl.class.php и меняем содержимое функции public function InitAction(){ на $aParamsNew=Router::GetParams();
if (Router::GetAction()=='error'){
$sUrl=trim(@$_SERVER['REDIRECT_URL'],'/');
if (!($oTopic=$this->Topic_GetTopicByUrl($sUrl))) {
return ;
}
if($oTopic->getBlog()->getType() != 'personal')
Router::Action('blog',$oTopic->getBlog()->getUrl(),array($oTopic->getId().'.html'));
else {
Router::Action('blog',$oTopic->getId().'.html',array());
}
}
активируем плагин, сбрасываем кеши.