Last active
October 9, 2019 18:32
-
-
Save andronex/e183903dcc331f154b25c8f79db81156 to your computer and use it in GitHub Desktop.
Добавление к title или alt атрибутам HTML тегов произвольного постфикса, например, названия сайта/компании.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($modx->event->name == "OnWebPagePrerender") { | |
$output = &$modx->resource->_output; | |
$postfix = $modx->getOption('title_postfix'); | |
$output = preg_replace('/title="([\s\S]*?)"/ui', 'title="$1 '.$postfix.'"', $output); | |
$output = str_replace('title=" | Энергоматика', 'title="Энергоматика', $output); | |
} | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* добавление постфикса в title страницы | |
*/ | |
if ($modx->event->name == "OnWebPagePrerender") { | |
$output = &$modx->resource->_output; | |
$postfix = $modx->getOption('title_postfix'); | |
$output = preg_replace('/<title>([\s\S]*?)<\/title>/ui', '<title>$1 '.$postfix.'</title>', $output); | |
} | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment