Skip to content

Instantly share code, notes, and snippets.

@sonicpunk
Created May 29, 2013 13:16
Show Gist options
  • Save sonicpunk/5670180 to your computer and use it in GitHub Desktop.
Save sonicpunk/5670180 to your computer and use it in GitHub Desktop.
MODX Snippet. Decide which HTML chunk to output based on what template ID you are looking for.
//Snippet Call [[ifElseTemplate? &ifId=`1` &ifTpl=`kontakt_info` &elseId=`4` &elseTpl=`kontakt_person_info`]]
<?php
$output='';
$template=$modx->resource->get('template');
if($template==$ifId){
$output.=$modx->getChunk($ifTpl);
}else if($template==$elseId){
$output.=$modx->getChunk($elseTpl);
};
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment