Last active
July 29, 2020 15:05
-
-
Save EscApp2/846161bf2e4675d6e0bf42c7d378bb65 to your computer and use it in GitHub Desktop.
bitrix set title, set properties, set meta after ajax
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
<? | |
function setTitle($Mess = false){ | |
if(!empty($Mess)){ | |
global $APPLICATION; | |
$APPLICATION->SetTitle($Mess); | |
?> | |
<script type="text/javascript"> | |
document.title = "<?=CUtil::JSEscape($Mess);?>"; | |
</script> | |
<? | |
} | |
} | |
function setPageProperty($property = false,$Mess = false){ | |
if(!empty($property) && !empty($Mess)){ | |
global $APPLICATION; | |
$APPLICATION->SetPageProperty($property, $Mess); | |
?> | |
<script type="text/javascript"> | |
if($('meta[name="<?=CUtil::JSEscape(ToLower($property));?>"]').length > 0){ | |
$('meta[name="<?=CUtil::JSEscape(ToLower($property));?>"]').attr('content', "<?=CUtil::JSEscape($Mess);?>"); | |
}else{ | |
$('head').append( '<meta name="<?=CUtil::JSEscape(ToLower($property));?>" content="<?=CUtil::JSEscape($Mess);?>">' ); | |
} | |
</script> | |
<? | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment