Kod
<li class="menu"><a href="##### title="test"><span>test</span></a></li>
wstawic image zeby wygladalo tak:Kod
<li class="menu"><a href=" title="test"><img src="#####.gif" alt="" /><span>test</span></a></li>
Znalazlem kod który wstawia span miedzy anchor text, teraz chce do niego wstawic jeszcze img:
oto kod:
Kod
function theme070_menu_local_task($link, $active = FALSE) {
return '<li '. ($active ? 'class="active" ' : '') .'><span><span>'. $link ."</span></span></li>\n";
}
//
/**
* Return a themed set of links.
*
* @param $links
* A keyed array of links to be themed.
* @param $attributes
* A keyed array of attributes
* @return
* A string containing an unordered list of links.
*/
function phptemplate_links($links, $attributes = array('class' => 'links')) {
$output = '';
if (count($links) > 0) {
$output = '<ul'. drupal_attributes($attributes) .'>';
$num_links = count($links);
$i = 1;
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']) {
$class .= ' active';
}
$output .= '<li class="'. $class .'">';
if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$link['html'] = TRUE;
$output .= l('<span>'. $link['title'] .'</span>', $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 .= "</li>\n";
}
$output .= '</ul>';
}
return $output;
}
return '<li '. ($active ? 'class="active" ' : '') .'><span><span>'. $link ."</span></span></li>\n";
}
//
/**
* Return a themed set of links.
*
* @param $links
* A keyed array of links to be themed.
* @param $attributes
* A keyed array of attributes
* @return
* A string containing an unordered list of links.
*/
function phptemplate_links($links, $attributes = array('class' => 'links')) {
$output = '';
if (count($links) > 0) {
$output = '<ul'. drupal_attributes($attributes) .'>';
$num_links = count($links);
$i = 1;
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']) {
$class .= ' active';
}
$output .= '<li class="'. $class .'">';
if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$link['html'] = TRUE;
$output .= l('<span>'. $link['title'] .'</span>', $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 .= "</li>\n";
}
$output .= '</ul>';
}
return $output;
}