sigil88
4/24/2017 - 10:23 AM

Simple Joomla 3 html/mod_banners override for carousel NOTE: needs check for description/content text limit with read more btn option ALSO

Simple Joomla 3 html/mod_banners override for carousel

NOTE: needs check for description/content text limit with read more btn option

ALSO - use get thumbs helper if available.

<?php
defined('_JEXEC') or die;

require_once JPATH_ROOT . '/components/com_banners/helpers/banner.php';

$baseurl 	= JUri::base();
$target 	= $params->get('target', 1);
$countBanners = count($list);

// die(print_r($list));
?>


<div id="carousel-featured-<?= $module->id; ?>" class="carousel slide" data-ride="carousel">
	<?php if ($countBanners > 1 ) : ?>
	<!-- Indicators -->
	<ol class="carousel-indicators">
		<?php foreach ($list as $key => $item) : ?>
			<li data-target="#carousel-featured-<?= $module->id; ?>" data-slide-to="<?= $key; ?>" class="<?= $key == 0 ? 'active' : '' ; ?>"></li>
		<?php endforeach; ?>
	</ol>
	<?php endif; ?>

	<!-- Wrapper for slides -->
	<div class="carousel-inner" role="listbox">
		<?php foreach ($list as $key => $item) : 
			$alt = $item->params->get('alt');
		?>

		<div class="item<?php echo $key == 0 ? ' active' : '' ; ?>">
		<?php if ($item->clickurl) :?>
			<a href="<?php echo $item->clickurl; ?>" target="<?php echo $target == 1 ? '_blank' : '' ; ?>">
				<img class="img-responsive" src="<?php echo $baseurl . $item->params->get('imageurl'); ?>" alt="<?= $alt ? $alt : false; ?>">
				<?php if ($item->description) : ?>
					<div class="carousel-caption">
						<?php echo $item->description; ?>
					</div>
				<?php endif; ?>
			</a>
		<?php else : ?>
			<img class="img-responsive" src="<?php echo $baseurl . $item->params->get('imageurl'); ?>" alt="<?= $alt ? $alt : false; ?>">
			<?php if ($item->description) : ?>
				<div class="carousel-caption">
					<?php echo $item->description; ?>
				</div>
			<?php endif; ?>
		<?php endif; ?>
		</div>
		<?php endforeach; ?>
	</div>

	<?php if ($countBanners > 1 ) : ?>
	<!-- Controls -->
	<a class="left carousel-control" href="#carousel-featured-<?= $module->id; ?>" role="button" data-slide="prev">
		<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
		<span class="sr-only">Previous</span>
	</a>
	<a class="right carousel-control" href="#carousel-featured-<?= $module->id; ?>" role="button" data-slide="next">
		<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
		<span class="sr-only">Next</span>
	</a>
	<?php endif; ?>
</div>