Skip to content

Instantly share code, notes, and snippets.

@mkay
Created January 17, 2014 20:15
Show Gist options
  • Save mkay/8480624 to your computer and use it in GitHub Desktop.
Save mkay/8480624 to your computer and use it in GitHub Desktop.
MODX snippet to use file based templates.
<?php
# Snippet to include file based templates
# USAGE: [[LoadTemplate? &tpl=`template.tpl`]]
$base_path = $modx->config['base_path'];
if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";
$tpl = $base_path .'assets/templates/'.$tpl; // change to your tpl dir path
ob_start();
include($tpl);
return ob_get_clean();
//?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment