Posted By

screamwork on 11/12/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

juanchifc


Horizontal SOCIAL LINKS for template.php (Drupal)


 / Published in: PHP
 

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

  1. function my_follows(){
  2. $social = 'http://www.facebook.com/your-name|facebook.png,http://www.youtube.com/your-name|youtube.png,..whatever u like..,END';
  3. $data = explode(',', $social, -1);
  4. $my_follow_o = '<ul id="my_follows">';
  5. $i=0;
  6. while($i < count($data)){
  7. $pair = explode('|', $data[$i], 2);
  8. $my_img = '<img src="'.base_path().'sites/all/themes/your-theme-name/images/'.$pair[1].'" />';
  9. $my_follow_o .= '<li>'.l($my_img, $pair[0], array('html' => 'true')).'</li>';
  10. $i++;
  11. }
  12. $my_follow_o .= '</ul>';
  13. return $my_follow_o;
  14. }
  15.  
  16. anywhere you like <?php print my_follows(); ?> to print out the links...
  17.  
  18. here's the CSS:
  19. ul#my_follows{
  20. padding-left: 0 ! important;
  21. overflow: hidden;
  22. text-align: center;
  23. }
  24. #my_follows li{
  25. display: inline;
  26. list-style: none;
  27. margin-right: 9px;
  28. }
  29. ul#my_follows > li:last-child{
  30. margin-right: 0px;
  31. }

Report this snippet  

You need to login to post a comment.