Created
February 12, 2010 20:41
-
-
Save chucktrukk/302961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This is a simple example. | |
I use h2o for all of my modx templating needs, because the php is kind of verbose. And h2o is as simple as [++] placeholders. | |
( http://wiki.github.com/speedmax/h2o-php/ ) | |
Twig is also a nice option. ( http://www.twig-project.org/ ) | |
*/ | |
$parent = isset($parent) ? $parent : $modx->documentIdentifier; | |
$results = $modx->getDocumentChildrenTVarOutput($parent, '*'); | |
/* The following would be included like so: | |
$template = isset($template) ? $template : false; | |
if( is_readable($template) || $template !== false) | |
{ | |
include_once $modx->config['base_path'] . '/'.$template; | |
} else { | |
echo 'File not found'; | |
} | |
*/ | |
?> | |
<?php if( ! $results): ?> | |
No results were found | |
<?php else: ?> | |
<div class="this-is-my-wrapper"> | |
<h2>Woohoo! We got results... below</h2> | |
<?php foreach($results as $document): ?> | |
<div class="item"> | |
<h3><?php echo $document['pagetitle'] ?></h3> | |
<div class="item-content"> | |
<?php echo $document['content']; ?> | |
</div> | |
</div> | |
<?php endforeach; ?> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment