Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next prev в component_epilog #17

Open
B0Bka opened this issue Sep 21, 2017 · 0 comments
Open

next prev в component_epilog #17

B0Bka opened this issue Sep 21, 2017 · 0 comments

Comments

@B0Bka
Copy link
Owner

B0Bka commented Sep 21, 2017

$cp = $this->__component; if (is_object($cp)) { $arResult['COUNT'] = count($arResult['ITEMS']); $cp->SetResultCacheKeys(array("NAV_RESULT")); }

`$nav_nomer = $arResult['NAV_RESULT']->NavPageNomer;
$NavPageCount = $arResult['NAV_RESULT']->NavPageCount;
$arUrl = explode('?', $_SERVER['REQUEST_URI']);
$dir = $arUrl[0];
if(!isset($_REQUEST['sort']) || $_REQUEST['sort'] == '')
{
if(preg_match("/page=([0-9]+)/$/", $dir, $matches))
{
$paging = $matches[1];
$page = preg_replace("/page=([0-9]+)/$/",'',$dir);
}
if($nav_nomer == 1 && $NavPageCount > 1)
{
$seo_link_next_url = $dir.'page=2/';
$APPLICATION->AddHeadString('',true);
}
elseif($nav_nomer > 1 && $nav_nomer < $NavPageCount)
{
if($nav_nomer == 2)
{
//$page = 'page='.
//$prev =
$seo_link_prev_url = str_replace('/page=2/', '/',$dir);
$APPLICATION->AddHeadString('',true);
}
else
{
$seo_link_prev_url = str_replace($paging, intval($nav_nomer)-1,$dir);
$APPLICATION->AddHeadString('',true);
}
$seo_link_next_url = str_replace($paging, intval($nav_nomer)+1,$dir);
$APPLICATION->AddHeadString('',true);

}
elseif($nav_nomer > 1 && $nav_nomer == $NavPageCount)
{
	if($nav_nomer == 2)
	{
		$seo_link_prev_url = str_replace('/page=2/', '/',$dir);
	}
	else $seo_link_prev_url = str_replace($paging, intval($nav_nomer)-1,$dir);
	$APPLICATION->AddHeadString('<link rel="prev" href="https://wallet.ua'.$seo_link_prev_url.'">',true);
}

}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant