Hauptmenulinks anpassen, <ul> <li>, Trennlinie nach jedem Link!
am 18.08.2012 - 18:10 Uhr in
An geigneter Stelle im page.tpl.php:
<?php
print theme('links', $primary_links, array('class' => 'links primary-links'))
?>Funktioniert soweit, auch wenn nicht in gewünster Darstellung.
Also ein template.php erstellt imt folgendem Inhalt:
<?php
/**
* Return a themed set of links.
* An override of theme_links()
* Modified to use simple text styling instead of HTML & CSS
*
* @see theme_links
*/
function THEMENAME_links($links, $attributes = array('class' => 'links')) {
$output = '';
// Change the way primary links are rendered
if($attributes['class'] == 'links primary-links') {
$linklist = array();
foreach ((array)$links as $key => $link) {
$linklist[] = l($link['title'], $link['href'], $link);
}
// Return the links joined by a '|' character
return join(' |', $linklist);
}
// Normal theming continued below:
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'] || ($link['href'] == '<front>' && drupal_is_front_page()))) {
$class .= ' active';
}
$output .= '<li 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 .= "</li>";
}
$output .= '</ul>';
}
return $output;
}
?>THEMENAME angepasst, nun sollte ich doch zB
$i++; $output .= "</li>"; In $output .= "</li><img ...>"; oder $output .= "</li><hr>"; Umschreiben können und sollte eine Linie zwischen die Links bringen.
Funktioniert aber nicht. Hab dies nun mit verschiedensten Tutorials als Hilfestellung versucht aber ohne Funktionierendes Resultat. Stunden damit verbrannt und mit den Nerven am ende drum..
Bitte Helft mit! Danke!!
- Anmelden oder Registrieren um Kommentare zu schreiben

Das kannst du auch mit reinem
am 18.08.2012 - 19:01 Uhr
Das kannst du auch mit reinem CSS lösen...
Den Listenelementen eine Border Right geben und dem letzten Element keine Border.
Das erklärt zwar noch nicht
am 18.08.2012 - 19:09 Uhr
Das erklärt zwar noch nicht wieso ich jetzt kein zugriff auf di ul&li Tags der Primary-Links kriege.. aber..
Wieso eigentlich nicht, man kanns ja AUsnahmsweise auch liecht machen obwohls schwer auch gehn würde ^^
Danke ;)