Темизация Primary-links в template.php
Опубликовано Dark в Втр, 19.10.2010 - 15:03
<?php function phptemplate_links($links, $attributes = array()) { if (!count($links)) { return ''; } $tree = menu_tree_page_data('primary-links'); foreach ($tree as $link_data) { if ($link_data['link']['in_active_trail']) { $m = array(); $m = $link_data['below']; if (isset($m) and is_array($m) and count($m)) $mm = menu_tree_output( $m ); break; } } $mmm = "<div class='ul-wrapper'><div class='ul-top'></div><div class='ul-content'>\n"; $mmm2 = "</div><div class='ul-bottom'></div></div>\n"; $level_tmp = explode('-', key($links)); $level = $level_tmp[0]; $output = "<ul class=\"links-$level ".$attributes['class']. "\">\n"; $i = 1; //print "<pre>"; print_r($attributes); print "</pre>"; foreach ($links as $index => $link) { $output .= '<li'; if (stristr($index, 'active')) { $output .= ' class="active '; $link['attributes']['class'] = 'active';//add class active to <li }// frontpage AND current-link in menu is <front> elseif((drupal_is_front_page()) && ($link['href']=='<front>')){ $link['attributes']['class'] = 'active';//add class active to <li $output .= ' class="active ';//add class active to <a } else { $output .= ' class="'; } if ($i % 2 == 0) $output .= 'odd"'; else $output .= 'even"'; $i++; //$output .= $i; if ($attributes['class'] == 'links sidebar-links' && $mm && $link['attributes']['class'] == 'active') { $output .= "><div class='li-content'><span class='l-span'> </span>". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."<span class='r-span'> </span></div>"; $output .= $mmm . $mm . $mmm2; $output .= "</li>\n"; } else { if ($attributes['class'] == 'links sidebar-links') { $output .= "><div class='li-content'><span class='l-span'> </span>". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."<span class='r-span'> </span></div>"; $output .= "</li>\n"; } else { $output .= "><span class='l-span'> </span>". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."<span class='r-span'> </span>"; $output .= "</li>\n"; } } } $output .= '</ul>'; return $output; } ?>

Комментариев нет
Отправить комментарий