Answer the question
In order to leave comments, you need to log in
How to add page number to description?
The Bitrix forum has a code that is inserted into init.php, how to add a page number to the title in the presence of pagination
AddEventHandler('main', 'OnEpilog', array('CMainHandlers', 'OnEpilogHandler'));
class CMainHandlers
{
public static function OnEpilogHandler()
{
if (isset($_GET['PAGEN_1']) && intval($_GET['PAGEN_1']) > 0) {
$title = $GLOBALS['APPLICATION']->GetTitle();
$GLOBALS['APPLICATION']->SetPageProperty('title', $title . ' - cтраница ' . intval($_GET['PAGEN_1']));
}
}
}
AddEventHandler('main', 'OnEpilog', array('CMainHandlers', 'OnEpilogHandler'));
class CMainHandlers
{
public static function OnEpilogHandler()
{
if (isset($_GET['PAGEN_1']) && intval($_GET['PAGEN_1']) > 0) {
$title = $GLOBALS['APPLICATION']->GetTitle();
$GLOBALS['APPLICATION']->SetPageProperty('title', $title . ' - cтраница ' . intval($_GET['PAGEN_1']));
$description = $GLOBALS['APPLICATION']->GetDescription();
$GLOBALS['APPLICATION']->SetPageProperty('description', $description . ' - cтраница ' . intval($_GET['PAGEN_1']));
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question