Skip to content

Instantly share code, notes, and snippets.

@4e6ka
Created October 10, 2024 05:53
Show Gist options
  • Save 4e6ka/c59a39dfa2e4dd586e3b218d1dfedc98 to your computer and use it in GitHub Desktop.
Save 4e6ka/c59a39dfa2e4dd586e3b218d1dfedc98 to your computer and use it in GitHub Desktop.
Сниппет для кеширования чанка, для старого парсера modx revo
snippet cache_chunk
<?php
$cache_key = "chunk_".$name;
$output = $modx->cacheManager->get($cache_key);
if (empty($output)) {
$output = $modx->getChunk($name, $scriptProperties);
$modx->cacheManager->set($cache_key,$output);
}
return $output;
?>
Пример вызова:
[[cache_chunk? &name=`header`]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment