]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
move js to js folder
[friendica.git] / include / text.php
index e3d984a1fe17d3c169a96481f6fbf10f3c77862d..78eae145e2c90a8617450e27ea31030cf08a4042 100644 (file)
@@ -539,22 +539,30 @@ function contact_block() {
                $total = intval($r[0]['total']);
        }
        if(! $total) {
-               $o .= '<h4 class="contact-h4">' . t('No contacts') . '</h4>';
-               return $o;
-       }
-       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d",
-                       intval($a->profile['uid']),
-                       intval($shown)
-       );
-       if(count($r)) {
-               $o .= '<h4 class="contact-h4">' .  sprintf( tt('%d Contact','%d Contacts', $total),$total) . '</h4><div id="contact-block">';
-               foreach($r as $rr) {
-                       $o .= micropro($rr,true,'mpfriend');
-               }
-               $o .= '</div><div id="contact-block-end"></div>';
-               $o .=  '<div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/' . $a->profile['nickname'] . '">' . t('View Contacts') . '</a></div>';
+               $contacts = t('No contacts');
+               $micropro = Null;
                
+       } else {
+               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d",
+                               intval($a->profile['uid']),
+                               intval($shown)
+               );
+               if(count($r)) {
+                       $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
+                       $micropro = Array();
+                       foreach($r as $rr) {
+                               $micropro[] = micropro($rr,true,'mpfriend');
+                       }
+               }
        }
+       
+       $tpl = get_markup_template('contact_block.tpl');
+       $o = replace_macros($tpl, array(
+               '$contacts' => $contacts,
+               '$nickname' => $a->profile['nickname'],
+               '$viewcontacts' => t('View Contacts'),
+               '$micropro' => $micropro,
+       ));
 
        $arr = array('contacts' => $r, 'output' => $o);