Created
November 14, 2014 14:10
-
-
Save esedic/1ecf72e0dc3c554ab938 to your computer and use it in GitHub Desktop.
K2 content module with bootstrap 3 rows
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 | |
// no direct access | |
defined('_JEXEC') or die; | |
/* | |
* Display K2 2 articles in 1 row (you can change to 3 or 4 or whatever - don't forget to change bootstrap col class) | |
*/ | |
?> | |
<div id="k2ModuleBox<?php echo $module->id; ?>" class=k2ItemsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>"> | |
<?php if($params->get('itemPreText')): ?> | |
<p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p> | |
<?php endif; ?> | |
<?php if(count($items)): ?> | |
<?php $i = 1; ?> | |
<div class="row"> | |
<?php foreach ($items as $item) : ?> | |
<div class="col-md-6"> | |
<!-- Plugins: BeforeDisplay --> | |
<?php echo $item->event->BeforeDisplay; ?> | |
<!-- K2 Plugins: K2BeforeDisplay --> | |
<?php echo $item->event->K2BeforeDisplay; ?> | |
<?php if($params->get('itemTitle')): ?> | |
<a class="moduleItemTitle" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a> | |
<?php endif; ?> | |
<?php if($params->get('itemDateCreated')): ?> | |
<p class="moduleItemDateCreated"><?php echo JText::_('K2_WRITTEN_ON') ; ?> <?php echo JHTML::_('date', $item->created, JText::_('K2_DATE_FORMAT_LC2')); ?></p> | |
<?php endif; ?> | |
<!-- Plugins: AfterDisplayTitle --> | |
<?php echo $item->event->AfterDisplayTitle; ?> | |
<!-- K2 Plugins: K2AfterDisplayTitle --> | |
<?php echo $item->event->K2AfterDisplayTitle; ?> | |
<!-- Plugins: BeforeDisplayContent --> | |
<?php echo $item->event->BeforeDisplayContent; ?> | |
<!-- K2 Plugins: K2BeforeDisplayContent --> | |
<?php echo $item->event->K2BeforeDisplayContent; ?> | |
<?php if($params->get('itemImage') || $params->get('itemIntroText')): ?> | |
<div class="moduleItemIntrotext mt-10 mb-5"> | |
<?php if($params->get('itemImage') && isset($item->image)): ?> | |
<a class="moduleItemImage" href="<?php echo $item->link; ?>" title="<?php echo JText::_('K2_CONTINUE_READING'); ?> "<?php echo K2HelperUtilities::cleanHtml($item->title); ?>""> | |
<img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"/> | |
</a> | |
<?php endif; ?> | |
<?php if($params->get('itemIntroText')): ?> | |
<?php echo $item->introtext; ?> | |
<?php endif; ?> | |
</div> | |
<?php endif; ?> | |
<!-- Plugins: AfterDisplayContent --> | |
<?php echo $item->event->AfterDisplayContent; ?> | |
<!-- K2 Plugins: K2AfterDisplayContent --> | |
<?php echo $item->event->K2AfterDisplayContent; ?> | |
<?php if($params->get('itemCategory')): ?> | |
<?php echo JText::_('K2_IN') ; ?> <a class="moduleItemCategory" href="<?php echo $item->categoryLink; ?>"><?php echo $item->categoryname; ?></a> | |
<?php endif; ?> | |
<?php if($params->get('itemAttachments') && count($item->attachments)): ?> | |
<div class="moduleAttachments"> | |
<?php foreach ($item->attachments as $attachment): ?> | |
<a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>"><?php echo $attachment->title; ?></a> | |
<?php endforeach; ?> | |
</div> | |
<?php endif; ?> | |
<?php if($params->get('itemReadMore')): ?> | |
<a class="moduleItemReadMore readmore btn btn-default btn-gradient" href="<?php echo $item->link; ?>"> | |
<?php echo JText::_('K2_READ_MORE'); ?> | |
</a> | |
<?php endif; ?> | |
<!-- Plugins: AfterDisplay --> | |
<?php echo $item->event->AfterDisplay; ?> | |
<!-- K2 Plugins: K2AfterDisplay --> | |
<?php echo $item->event->K2AfterDisplay; ?> | |
</div> | |
<?php if($i % 2 == 0) : ?> | |
</div> | |
<div class="row mb-10 pb-10 pt-10"> | |
<?php endif; ?> | |
<?php $i++; ?> | |
<?php endforeach; ?> | |
</div> | |
<?php endif; ?> | |
<?php if($params->get('itemCustomLink')): ?> | |
<a class="moduleCustomLink readmore btn btn-primary" href="<?php echo $params->get('itemCustomLinkURL'); ?>" title="<?php echo K2HelperUtilities::cleanHtml($itemCustomLinkTitle); ?>"><?php echo $itemCustomLinkTitle; ?></a> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment