Skip to content
Browse files

add switch template as an example

  • Loading branch information...
1 parent 8c03beb commit d151059c686e0aa44e8d956d198a304a001e989e @chucktrukk committed May 11, 2010
Showing with 23 additions and 0 deletions.
  1. +23 −0 template_with_switch.php
View
23 template_with_switch.php
@@ -0,0 +1,23 @@
+<?php
+
+
+$tpl_path = $modx->config['base_path'].'site/templates/';
+$template_id = $modx->documentObject['template'];
+
+switch($template_id)
+{
+ # Home
+ case 1:
+ $output = file_get_contents($tpl_path.'home.html');
+ break;
+ # FAQ
+ case 2:
+ $output = file_get_contents($tpl_path.'faq.html');
+
+ default:
+ /* You could also set a default file here */
+ $output = 'No file found';
+ break;
+}
+
+echo $output;

0 comments on commit d151059

Please sign in to comment.
Something went wrong with that request. Please try again.