Friends List

: mod_weblinks

Live demo

Website
John Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Chris Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Clark Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Terri Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Magda Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Phil Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Ken Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula.

Website
Ross Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula. 

Website
Mark Doe

Nunc luctus in metus eget fringilla. Aliquam sed justo ligula.

Markup

<?php
/**
 * @package     Joomla.Site
 * @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">
			<?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="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; ?>
					</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="container">  
    <div class="friend-list">
		
		<div class="row <?php echo $moduleclass_sfx; ?>">
	
			<?php foreach ($list as $item) : ?>
		
            <div class="col-md-4 col-sm-6">
				<div class="friend-card">
				
					<?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 alt="" class="img-responsive cover" src="/<?php echo $images->image_first; ?>" />
					</div>
					<?php endif; ?>	
					
					<div class="card-info">
						<?php $images = json_decode($item->images); ?>
						<?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 alt="" class="profile-photo-lg" src="/<?php echo htmlspecialchars($images->image_second); ?>" />
						</div>
						<?php endif; ?>
						
						<div class="friend-info">
						
							<?php $link = $item->link; ?>
							<?php
								switch ($item->params->get('target', 3))
								{
									case 1:
									// Open in a new window
									echo '<a href="' . $link . '" class="pull-right text-green" target="_blank" rel="' . $params->get('follow', 'nofollow') . '">website</a>';
									break;
									
									case 2:
									// Open in a popup window
									echo "<a class=\"pull-right text-green\" 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 . '" class="pull-right text-green" rel="' . $params->get('follow', 'nofollow') . '">Website</a>';
									break;
								}
							?>							
							
							<h5 class="font-weight-bold">
							<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>
							</h5> 
							
							<?php if ($params->get('description', 0)) : ?>
							<p><?php echo nl2br($item->description); ?></p>
							<?php endif; ?> 
						</div>
					</div>
				</div>
			</div>                
		<?php endforeach; ?>
		</div>
	</div>
	
</div>
<?php endif; ?>

CSS

.friend-list .friend-card{
  border-radius: 4px;
  border-bottom: 1px solid #f1f2f2;
  overflow: hidden;
  margin-bottom: 20px;
}
.friend-list .friend-card .card-info{
  padding: 0 20px 10px;
}
.friend-list .friend-card .card-info img.profile-photo-lg{
  margin-top: -60px;
  border: 7px solid #fff;
}
img.profile-photo-lg {
    height: 80px;
    width: 80px;
    border-radius: 50%;
}
.text-green {
    color: #8dc63f;
}
Daniel Dubois

Daniel Dubois

Passionné par le Web 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.
Très impliqué dans la communauté Joomla depuis 2014, il est actif au sein de plusieurs projets, conférencier et fondateur du JUG Breizh.