Thursday, August 19, 2010

Example of theme links

Below is the example of used of theme_links

<?php
$friend_req = $row->counts; //says db_query has been defined
$message = privatemsg_unread_count(); // count new privatemsg

if($friend_req >= 1){
    $friend_req_count = format_plural($friend_req, t('1 Friendship request'), t('@count Friendship requests'));
}

if($message >= 1){
    $message_count = format_plural($message, t('1 New message'), t('@count New messages'));   
}




//define $links as array
$links = array();
$links[] = array('title' => $friend_req_count, 'href' => 'relationships/requests', 'attributes' => array('class' => 'friend-requests'));
$links[] = array('title' => $message_count, 'href' => 'messages', 'attributes' => array('class' => 'messages'));
 
//use theme links to display link
print theme('links', $links);

?>

No comments:

Post a Comment