{if $request.serial == 'CM'} {extends "layout2.tpl"} {else} {extends "layout.tpl"} {/if}
Однако в синтаксисе Smarty я пока новичок.
{if $request.serial == 'CM'} {include "layout2.tpl"} {else} {include "layout.tpl"} {/if}
<?php $properties = $modx->resource->getOne('Template')->getProperties(); if(!empty($properties['tpl'])){ $tpl = $properties['tpl']; } elseif($request.serial == 'CM') $tpl = 'index2.tpl'; else{ $tpl = 'index.tpl'; } if ($modx->resource->cacheable != '1') { $modx->smarty->caching = false; } if(!empty($properties['phptemplates.non-cached'])){ $modx->smarty->compile_check = false; $modx->smarty->force_compile = true; } return $modx->smarty->fetch("tpl/{$tpl}");
elseif($request.serial == 'CM') $tpl = 'index2.tpl';
<?php $properties = $modx->resource->getOne('Template')->getProperties(); if(!empty($properties['tpl'])){ $tpl = $properties['tpl']; } elseif($_REQUEST['serial'] == 'cm' or $_REQUEST['serial'] == 'CM') $tpl = 'index2.tpl'; else{ $tpl = 'index.tpl'; } if ($modx->resource->cacheable != '1') { $modx->smarty->caching = false; } if(!empty($properties['phptemplates.non-cached'])){ $modx->smarty->compile_check = false; $modx->smarty->force_compile = true; } return $modx->smarty->fetch("tpl/{$tpl}");
1. in_array($_REQUEST['serial'], array( 'cm', 'CM')); strtolower($_REQUEST['serial']) == 'cm'; mb_convert_case($_REQUEST['serial'], MB_CASE_LOWER) == 'cm'; preg_match('/^cm$/i', $_REQUEST['serial']); // И главное: strcasecmp($_REQUEST['serial'], 'cm') === 0;
strcasecmp($_REQUEST['serial'], 'cm') === 0;