Skip to content

Commit

Permalink
add switch template as an example
Browse files Browse the repository at this point in the history
  • Loading branch information
chucktrukk committed May 11, 2010
1 parent 8c03beb commit d151059
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions template_with_switch.php
Original file line number Original file line Diff line number Diff line change
@@ -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.