Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($modx->event->name == 'OnWebPageInit' && isset($_GET['template'])) {
- $template = (int) $_GET['template'];
- // Допустимые шаблоны
- if (!in_array($template, array(0,1,2))) return true;
- // Получаем ресурс
- if (!is_object($modx->resource)) {
- $modx->resource = $modx->request->getResource($modx->resourceMethod, $modx->resourceIdentifier);
- }
- // Меняем шаблон у ресурса
- $modx->resource->template = $template;
- // Делаем ресурс не кэшируемым
- $modx->resource->cacheable = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement