MODx Include Template

/ Published in: PHP
Save to your folder(s)

Code to include template files in MODx. This way files can be edited in Dreamweaver or other editor without cutting and pasting into the Manager all the time.

Copy this code and paste it in your HTML
  1. <?php
  2. # Snippet to include template files from file system
  3. # USAGE: [[includeTemplate? &tpl=`mytemplate/template.html`]]
  5. if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";
  7. $tpl = $base_path .'assets/templates/'.$tpl;
  8. include($tpl);
  9. return ob_get_clean();
  10. ?>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.