By Wassim Ghannoum on
i want to show an icon (add more comment) in the bottom of each node..
so i've redeclared the method theme_links, in the template.php file
i've writed this code
function theme_links($links, $attributes = array('class' => 'links')) {
global $language;
$output = '';
if (count($links) > 0) {
$output = '<div'. drupal_attributes($attributes) .'>';
$num_links = count($links);
$i = 1;
//print_r(array_keys($links['comment_add']));print
if (isset($links['comment_add']['title']))
{
$links['comment_add']['title']='<img src="'.base_path() .'themes/sandium/images/add-comment.png"/>';
}
foreach ($links as $key => $link) {
$class = $key;
// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$class .= ' first';
}
if ($i == $num_links) {
$class .= ' last';
}
if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
&& (empty($link['language']) || $link['language']->language == $language->language)) {
$class .= ' active';
}
$output .= '<span'. drupal_attributes(array('class' => $class)) .'>';
if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$output .= l($link['title'], $link['href'], $link);
}
else if (!empty($link['title'])) {
// Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (empty($link['html'])) {
$link['title'] = check_plain($link['title']);
}
$span_attributes = '';
if (isset($link['attributes'])) {
$span_attributes = drupal_attributes($link['attributes']);
}
$output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
}
$i++;
$output .= "</span>\n";
}
$output .= '</div>';
}
return $output;
}
it work's okay, the problem is that i cant view any image...
the image is printed like a text <img src="/test/themes/sandium/images/add-comment.png"/>
so how can i fix this? i want to show an image???
Comments
A brief solution that may
A brief solution that may help.
In your template.php file
make sure the 'html' => TRUE
cheers
David
thanks cheese and bread for
thanks cheese and bread for the help
i've tried this code:
but it doesen't work, so i've modified my last code, and i've added
$link['html'] = TRUE;before print the $output, and it works great for me, this is the new codeYou need add the final line
You need add the final line try this
also it doesen't work... i've
also it doesen't work...
i've made a brief modification to make it working