I'm trying to replace the text link with an image in my forum, but cannot find anything in the API for image links. Seems like it would be simple, but the closest I can get is just a plain image. See below

Original Code:

	function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {

....
	    if (user_access('create forum topics')) {
	      // $output .= '<li>'. l(t('Post new forum topic.'), "node/add/forum/$tid") .'</li>';
	    }
....

Modified Code With Image:

	function next_gen_theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {
....
	    if (user_access('create forum topics')) {
	      $output .= '<li>'. theme_image('themes/next_gen_theme/images/post-new-topic.png', $alt = 'Post a New Topic', $title = 'Post a New Topic', "node/add/forum/$tid") .'</li>';
	    }

How can I make the image into a link??

Comments

twanduiv’s picture

To create links with images you will need to change the $html variable from FALSE to TRUE in the link-function. It is located in 'common.inc' around line 1264:

...
function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = TRUE)
...

The code in your function should then be somewhat like:

    function theme_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page) {

....
        if (user_access('create forum topics')) {
          $output .= '<li>'. l(theme_image('themes/next_gen_theme/images/post-new-topic.png', $alt = 'Post a New Topic', $title = 'Post a New Topic'), "node/add/forum/$tid") .'</li>';
        }
....