Last active
August 29, 2015 14:04
-
-
Save gayanvirajith/2a43e7325136c7ecca7c to your computer and use it in GitHub Desktop.
Sample ProcessWire function usage.
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
/** | |
* Returns site feature set markup | |
* @return String - html markup of features | |
*/ | |
function getFeatureSet() { | |
$pages = wire('pages')->find("template=conversion-feature"); | |
if (!count($pages)) return ''; | |
$out = ''; | |
$config = wire('config'); | |
$perPage = 3; | |
$featureItems = array_chunk($pages->getArray(), $perPage); | |
//Create delegate template | |
$template = new TemplateFile($config->paths->templates . "markup/feature-set.inc"); | |
//assign the rendered view to content variable to show up on _done.php | |
$template->set('featureItems', $featureItems); | |
$out .= $template->render(); | |
return $out; | |
} | |
//on your output template | |
<?php $counter = 0;?> | |
<?php foreach($featureItems as $i => $featureChunk): ?> | |
<div class="row row-<?php echo $i?>"> | |
<?php foreach($featureChunk as $featureItem):?> | |
<div class='col-lg-4 col-md-4 col-sm-4 text-center feature'> | |
<div class='animated hiding' data-animation='fadeInUp' data-delay='<?php echo ($counter*500)?>'> | |
<?php echo $helper->faIconLong($featureItem->label_text); ?> | |
<h3><?php echo $featureItem->title ?></h3> | |
<?php if ($featureItem->body) echo $featureItem->body; ?> | |
</div> | |
</div> | |
<?php ++$counter; endforeach; ?> | |
</div> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment