Weblinks

: mod_weblinks

Live demo

launch.joomla.org

Launch your free Joomla website in a minute

Visit Website

 

Joomla.org

The home of Joomla!, the best content management system (CMS)

Visit Website

 

extensions.joomla.org

The plateform to boost your Joomla website

Visit Website

 

Markup

<?php
	/**
		* @package     Joomla.Administrator
		* @subpackage  Weblinks
		* @Author	   web-eau.net
		* @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
		* @license     GNU General Public License version 2 or later; see LICENSE.txt
	*/
	
	defined('_JEXEC') or die;
?>

<?php if ($params->get('groupby', 0)) : ?>
<?php $cats = array(); ?>
<?php $cols = $params->get('groupby_columns', 3); ?>
<?php foreach ($list as $l) : ?>
<?php $cats[] = array('catid' => $l->catid, 'title' => $l->category_title); ?>
<?php endforeach; ?>
<?php $cats = array_values(array_map('unserialize', array_unique(array_map('serialize', $cats)))); ?>
<?php foreach ($cats as $k => $cat) : ?>
<?php $items = array(); ?>
<?php foreach ($list as $item) : ?>
<?php if ($item->catid == $cat['catid']) : ?>
<?php $items[] = $item; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($cols > 1) : ?>
<?php if ($k % $cols == 0) : ?>

<div class="row row-fluid">
	<?php endif; ?>
	<div class="span<?php echo (12 / $cols); ?>">
		<?php endif; ?>
		<?php if ($params->get('groupby_showtitle', 1)) : ?>
		<h4><?php echo htmlspecialchars($cat['title'], ENT_COMPAT, 'UTF-8'); ?></h4>
		<?php endif; ?>		
		
		<ul class="list-unstyled weblinks<?php echo $moduleclass_sfx; ?>">
			<?php foreach ($items as $item) : ?>
			<li>
				<?php $link = $item->link; ?>
				<?php
					switch ($item->params->get('target', 3))
					{
						case 1:
						// Open in a new window
						echo '<a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
						htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
						break;
						
						case 2:
						// Open in a popup window
						echo "<a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
						htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
						break;
						
						default:
						// Open in parent window
						echo '<a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
						htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a>';
						break;
					}
				?>
                  
				<?php if ($params->get('description', 0)) : ?>
				<?php echo nl2br($item->description); ?>
				<?php endif; ?>
				
				<?php if ($params->get('hits', 0)) : ?>
				<?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?>
				<?php endif; ?>
				
				<?php $images = json_decode($item->images); ?>
				<?php  if (isset($images->image_first) and !empty($images->image_first)) : ?>
				<div class="img-intro pull-<?php echo htmlspecialchars($images->float_first); ?>"> 
					<img src="/<?php echo $images->image_first; ?>" />
				</div>
				<?php endif; ?>
                  
				<?php  if (isset($images->image_second) and !empty($images->image_second)) : ?>
				<div class="img-thumbnail img-intro pull-<?php echo htmlspecialchars($images->float_second); ?>"> 
					<img src="/<?php echo htmlspecialchars($images->image_second); ?>" />
				</div>
				<?php endif; ?>
				
			</li>
			<?php endforeach; ?>
		</ul>
		<?php if ($cols > 1) : ?>
	</div>
	<?php if(($k + 1) % $cols == 0 || $k == count($cats) - 1) : ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>

  
  
<?php else : ?>
  
<div class="card-deck <?php echo $moduleclass_sfx; ?>">
	
	<?php foreach ($list as $item) : ?>
	
	<div class="card">      
		
		<?php $images = json_decode($item->images); ?>
		<?php  if (isset($images->image_first) and !empty($images->image_first)) : ?>
		<div class="img-thumbnail card-img-top img-intro pull-<?php echo htmlspecialchars($images->float_first); ?>"> 
			<img src="/<?php echo $images->image_first; ?>" alt="" />
		</div>
		<?php endif; ?>
		
		<div class="card-body">
			<?php $link = $item->link; ?>
			<?php
				switch ($item->params->get('target', 3))
				{
					case 1:
					// Open in a new window
					echo '<h3><a href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">' .
					htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a></h3>';
					break;
					
					case 2:
					// Open in a popup window
					echo "<h3><a href=\"#\" onclick=\"window.open('" . $link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\">" .
					htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a></h3>';
					break;
					
					default:
					// Open in parent window
					echo '<h3><a href="' . $link . '" rel="' . $params->get('follow', 'nofollow') . '">' .
					htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8') . '</a></h3>';
					break;
				}
			?>
			
			<?php if ($params->get('description', 0)) : ?>
			<p class="card-text"><?php echo nl2br($item->description); ?></p>
			<?php endif; ?>			
			
			<?php if ($params->get('hits', 0)) : ?>
			<div class="card-footer">
            <p class="card-text"><small class="text-muted"><?php echo '(' . $item->hits . ' ' . JText::_('MOD_WEBLINKS_HITS') . ')'; ?></small></p>            			
            </div>
 			<?php endif; ?> 

            <p class="card-text"><a class="btn btn-outline-success" href="' . $link . '" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">Visit Website</a></p>   			
			<div style="clear:both;width:100%;visibility:hidden;">&nbsp;</div>
			
		</div>
	</div>
	<?php endforeach; ?>
</div>
<?php endif; ?>
 

A PROPOS DE L'AUTEUR :
Webmaster freelance passionné par Joomla depuis 2007, Daniel défend la veuve et l'orphelin du web en créant des sites respectueux du W3C. Fort d'une expérience de plusieurs années, il partage ses connaissances dans un état d'esprit open source.
Daniel est également très impliqué dans la communauté Joomla depuis 2014 en étant membre actif de plusieurs projets, conférencier et fondateur du JUG Breizh.