Return to Snippet

Revision: 35733
at November 12, 2010 11:04 by screamwork


Initial Code
function my_follows(){
  $social = 'http://www.facebook.com/your-name|facebook.png,http://www.youtube.com/your-name|youtube.png,..whatever u like..,END';
  $data = explode(',', $social, -1);
  $my_follow_o = '<ul id="my_follows">';
  $i=0;
  while($i < count($data)){
    $pair = explode('|', $data[$i], 2);
    $my_img = '<img src="'.base_path().'sites/all/themes/your-theme-name/images/'.$pair[1].'" />';
    $my_follow_o .= '<li>'.l($my_img, $pair[0], array('html' => 'true')).'</li>';
		$i++;
  }
  $my_follow_o .= '</ul>';
  return $my_follow_o;
}

anywhere you like <?php print my_follows(); ?> to print out the links...

here's the CSS:
ul#my_follows{
	padding-left: 0 ! important;
	overflow: hidden;
	text-align: center;
}
#my_follows li{
	display: inline;
	list-style: none;
	margin-right: 9px;
}
ul#my_follows > li:last-child{
	margin-right: 0px;
}

Initial URL


Initial Description
Images into your themes images folder, if different then change the path in while loop

Initial Title
Horizontal SOCIAL LINKS for template.php (Drupal)

Initial Tags


Initial Language
PHP