Skip to content

Instantly share code, notes, and snippets.

@krasnikovdev
Created October 13, 2017 12:03
Show Gist options
  • Save krasnikovdev/c1b62dcf566e54339e16cda857da1748 to your computer and use it in GitHub Desktop.
Save krasnikovdev/c1b62dcf566e54339e16cda857da1748 to your computer and use it in GitHub Desktop.
Fenom
{set $properties['tpl'] = $_modx->getPlaceholder('template.tpl')}
{if empty($properties['tpl'])}
{set $properties['tpl'] = "default"}
{/if}
{include "file:templates/tpl/{$properties['tpl']}.tpl"}
<?php
if($modx->context->key == "mgr"){
return;
}
switch($modx->event->name){
case "OnLoadWebDocument":
if(is_object($modx->resource) && $modx->resource->id > 0 && $modx->resource->template > 0 && $template = $modx->resource->getOne('Template')->getProperties()){
if(is_array($template) && count($template)){
$modx->setPlaceholders($template,'template.');
}
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment