NiceMenu: Bild oben und unten vom Dropdown
Eingetragen von hellermann (7)
am 03.08.2008 - 12:39 Uhr in
am 03.08.2008 - 12:39 Uhr in
Mahlzeit ;) ....
ich habe das Nice Menu installiert funktioniert soweit auch super.
danach habe ich in den hintergrund via CSS background-images gelegt... funltioniert auch soweit super.
nun möchte ich aber oben und unten als "Anfang und Ende" vom Menü eine Grafik haben
ich habe das mal Bildlich verdeutlicht
ich denke, es ist soweit ersichtlich, was ich brauche.
nun noch einbischen quelltext
einmal das Modul (ich denke, da muss ich die bilder noch einfügen)
<?php
// $Id: nice_menus.module,v 1.35.2.11 2008/03/30 14:54:34 add1sun Exp $
/*
Module to enable CSS dropdown and flyout menus.
Maintainer: Addison Berry (add1sun)
Originally written by Jake Gordon (jakeg)
*/
/**
* Implementation of hook_help().
*/
function nice_menus_help($path, $arg) {
$output = '';
switch ($path) {
case 'admin/settings/modules#description':
$output .= t('Make drop down/flyout CSS menus for site and admin menus.');
break;
case 'admin/settings/nice_menus':
$output .= t('<p>This is a simple module that enables the site to have drop down/flyout CSS menus for site and admin navigation.</p><p>Remember to activate and configure the menu blocks in !link</p>', array('!link' => l('admin/build/block', 'admin/build/block')));
break;
}
return $output;
}
/**
* Implementation of hook_form_alter().
*/
function nice_menus_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'system_theme_settings':
// This is a global setting, so only insert the field
// on the global settings page.
if (arg(4)) {
return;
}
// Have to add a custom submit handler since this form doesn't use
// the standard system submit handler.
$form['#submit'][] = 'nice_menus_system_theme_settings_submit';
// Add global theme setting for a custom CSS file.
$form['nice_menus_custom_css'] = array(
'#type' => 'textfield',
'#title' => t('Path to custom Nice Menus CSS file'),
'#description' => t('To override the default Nice Menus CSS layout, enter the path to your custom CSS file. It should be a relative path from the root of your Drupal install (e.g. sites/all/themes/example/mymenu.css).'),
'#default_value' => variable_get('nice_menus_custom_css', ''),
// Field appears below submit buttons without this -- yucky.
'#weight' => 0,
);
break;
}
}
/**
* Records the nice menu custom CSS file per theme.
*/
function nice_menus_system_theme_settings_submit($form, &$form_state) {
variable_set('nice_menus_custom_css', $form_state['values']['nice_menus_custom_css']);
}
/**
* Implemention of hook_menu().
*/
function nice_menus_menu() {
$items['admin/settings/nice_menus'] = array(
'title' => 'Nice Menus',
'description' => 'Configure Nice Menus.',
'page callback' => 'drupal_get_form',
'page arguments' => array('nice_menus_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Settings form as implemented by hook_menu
*/
function nice_menus_admin_settings() {
$form['nice_menus_number'] = array(
'#type' => 'textfield',
'#description' => t('The total number of independent Nice menus blocks you want. Enter a number between 0 and 99. If you set this to 0, you will have no blocks created but you can still use the Nice menus theme functions directly in your theme.'),
'#default_value' => variable_get('nice_menus_number', '2'),
'#size' => 2,
);
// Custom validation to make sure the user is entering numbers.
$form['#validate'][] = 'nice_menus_settings_validate';
return system_settings_form($form);
}
/**
* Custom validation for the settings form.
**/
function nice_menus_settings_validate($form, &$form_state) {
$number = $form_state['values']['nice_menus_number'];
// Check to make sure it is a number and that is a maximum of 2 digits.
if (!is_numeric($number) || strlen($number) > 2) {
form_set_error('nice_menus_number', t('You must enter a number from 0 to 99.'));
}
}
/**
* Implementation of hook_block().
*/
function nice_menus_block($op = 'list', $delta = 0, $edit = array()) {
global $user;
switch ($op) {
case 'list':
for ($i = 1; $i <= variable_get('nice_menus_number', '2'); $i++) {
$blocks[$i]['info'] = variable_get('nice_menus_name_'. $i, 'Nice Menu '. $i) .' (Nice Menu)';
}
return $blocks;
break;
case 'configure':
$form['nice_menus_name_'. $delta] = array(
'#type' => 'textfield',
'#title' => t('Menu Name'),
'#default_value' => variable_get('nice_menus_name_'. $delta, 'Nice Menu '. $delta),
);
$form['nice_menus_menu_'. $delta] = array(
'#type' => 'select',
'#title' => t('Source Menu Tree'),
'#description' => t('The menu tree from which to show a nice menu.'),
'#default_value' => variable_get('nice_menus_menu_'. $delta, 'navigation:0'),
'#options' => menu_parent_options(menu_get_menus(), 0),
);
$form['nice_menus_type_'. $delta] = array(
'#type' => 'select',
'#title' => t('Menu Style'),
'#description' => t('right: menu items are listed on top of each other and expand to the right') .'<br />'. t('left: menu items are listed on top of each other and expand to the left') .'<br />'. t('down: menu items are listed side by side and expand down'),
'#default_value' => variable_get('nice_menus_type_'. $delta, 'right'),
'#options' => drupal_map_assoc(array('right', 'left', 'down')),
);
return $form;
break;
case 'save':
variable_set('nice_menus_name_'. $delta, $edit['nice_menus_name_'. $delta]);
variable_set('nice_menus_menu_'. $delta, $edit['nice_menus_menu_'. $delta]);
variable_set('nice_menus_type_'. $delta, $edit['nice_menus_type_'. $delta]);
break;
case 'view':
// Build the nice menu for the block.
list($menu_name, $mlid) = explode(':', variable_get('nice_menus_menu_'. $delta, 'navigation:0'));
$direction = variable_get('nice_menus_type_'. $delta, 'right');
if ($output = theme('nice_menu', $delta, $menu_name, $mlid, $direction)) {
$block['content'] = $output['content'];
if (variable_get('nice_menus_type_'. $delta, 'right') == 'down') {
$class = 'nice-menu-hide-title';
}
else {
$class = 'nice-menu-show-title';
}
// If we're building the navigation block
// use the same block title logic as menu module.
if ($output['subject'] == t('navigation') && $user->uid) {
$subject = $user->name;
}
else {
$subject = $output['subject'];
}
$block['subject'] = '<span class="'. $class .'">'. check_plain($subject) .'</span>';
}
else {
$block['content'] = false;
}
return $block;
break;
}
}
/**
* Implmentation of hook_theme().
**/
function nice_menus_theme() {
return array(
'nice_menu_tree' => array(
'arguments' => array('menu_name' => NULL, 'mlid' => NULL, 'menu' => NULL),
),
'nice_menu_build' => array(
'arguments' => array('menu' => NULL),
),
'nice_menu' => array(
'arguments' => array('id' => NULL, 'menu_name' => NULL, 'mlid' => NULL, 'direction' => 'right', 'menu' => NULL),
),
'nice_menu_primary_links' => array(
'arguments' => array('direction' => 'down', 'menu' => NULL),
),
'nice_menu' => array(
'arguments' => array('id' => NULL, 'pid' => NULL, 'direction' => 'right', 'menu' => NULL),
),
'nice_menu_primary_links' => array(
'arguments' => array('direction' => 'down', 'menu' => NULL),
),
);
}
/**
* Implementation of hook_init().
*
* We are adding the JavaScript and CSS here rather than theme_nice_menu
* because when block caching is enabled none of it would get fired
* and the menus are unstyled.
**/
function nice_menus_init() {
// We only want to include the JS for IE and not browsers
// capable of doing everything in css. We have to put all the JS
// in drupal_set_html_head so they get called in the right order. ;-(
drupal_set_html_head('<!--[if IE]>
<script type="text/javascript" src="'. check_url(base_path() .'misc/jquery.js') .'"></script>
<script type="text/javascript" src="'. check_url(base_path() .'misc/drupal.js') .'"></script>
<script type="text/javascript" src="'. check_url(base_path() . drupal_get_path('module', 'nice_menus') .'/nice_menus.js') .'"></script>
<![endif]-->');
// Add main CSS functionality.
drupal_add_css(drupal_get_path('module', 'nice_menus') .'/nice_menus.css');
// Add custom CSS layout if specified.
if ($custom = variable_get('nice_menus_custom_css', '')) {
drupal_add_css($custom);
}
// Fall back to default layout.
else {
drupal_add_css(drupal_get_path('module', 'nice_menus') .'/nice_menus_default.css');
}
}
/**
* Builds the final nice menu.
*
* @param $menu_name
* The top-level menu name that contains the menu to use (e.g. navigation
* or primary-links) for Drupal menus. For custom $menus this is just the
* name for menu display.
* @param $mlid
* The menu ID from which to start building the items, i.e. the parent
* of the displayed menu.
* @param $menu
* Optional. A custom menu array to use for theming -- it should have
* the same structure as that returned by menu_tree_all_data().
* @return
* An HTML string of properly nested nice menu lists.
*/
function theme_nice_menu_tree($menu_name, $mlid = NULL, $menu = NULL) {
// Load the full menu array.
$menu = isset($menu) ? $menu : menu_tree_all_data($menu_name);
// For custom $menus and menus built all the way from the top-level we
// don't need to "create" the specific sub-menu and we need to get the title
// from the $menu_name since there is no "parent item" array.
// Create the specific menu if we have a mlid.
if (!empty($mlid)) {
// Load the parent menu item.
$item = menu_link_load($mlid);
$title = $item['title'];
// Narrow down the full menu to the specific sub-tree we need.
for ($p = 1; $p < 10; $p++) {
if ($sub_mlid = $item["p$p"]) {
$subitem = menu_link_load($sub_mlid);
// Menu sets these ghetto-ass keys in _menu_tree_check_access().
$menu = $menu[(50000 + $subitem['weight']) .' '. $subitem['title'] .' '. $subitem['mlid']]['below'];
}
}
}
// Otherwise just set a title and move on.
else {
$title = $menu_name;
}
$output['content'] = '';
$output['subject'] = $title;
if ($menu) {
$output['content'] .= theme('nice_menu_build', $menu);
}
return $output;
}
/**
* Helper function that builds the nested lists of a nice menu.
*
* @param $menu
* Menu array from which to build the nested lists.
*/
function theme_nice_menu_build($menu) {
$output = '';
foreach ($menu as $menu_item) {
$mlid = $menu_item['link']['mlid'];
// Check to see if it is a visible menu item.
if ($menu_item['link']['hidden'] == 0) {
// Build class name based on menu path
// e.g. to give each menu item individual style.
// Strip funny symbols.
$clean_path = str_replace(array('http://', '<', '>', '&', '=', '?', ':'), '', $menu_item['link']['href']);
// Convert slashes to dashes.
$clean_path = str_replace('/', '-', $clean_path);
$path_class = 'menu-path-'. $clean_path;
// If it has children build a nice little tree under it.
if ((!empty($menu_item['link']['has_children'])) && (!empty($menu_item['below']))) {
// Keep passing children into the function 'til we get them all.
$children = theme('nice_menu_build', $menu_item['below']);
// Set the class to parent only of children are displayed.
$parent_class = $children ? 'menuparent ' : '';
$output .= '<li id="menu-'. $mlid .'" class="'. $parent_class . $path_class .'">'. theme('menu_item_link', $menu_item['link']);
// Build the child UL only if children are displayed for the user.
if ($children) {
$output .= '<ul>';
$output .= $children;
$output .= "</ul>\n";
}
$output .= "</li>\n";
}
else {
$output .= '<li id="menu-'. $mlid .'" class="'. $path_class .'">'. theme('menu_item_link', $menu_item['link']) .'</li>'."\n";
}
}
}
return $output;
}
/**
* General theming function to allow any menu tree to be themed
* as a nice menu.
*
* @param $id
* The nice menu ID.
* @param $menu_name
* The top parent menu name from which to build the full menu.
* @param $mlid
* The menu ID from which to build the displayed menu.
* @param $direction
* Optional. The direction the menu expands. Default is 'right'.
* @param $menu
* Optional. A custom menu array to use for theming --
* it should have the same structure as that returned
* by menu_tree_all_data(). Default is the standard menu tree.
* @return
* An HTML string of nice menu links.
*/
function theme_nice_menu($id, $menu_name, $mlid, $direction = 'right', $menu = NULL) {
$output = array();
if ($menu_tree = theme('nice_menu_tree', $menu_name, $mlid, $menu)) {
if ($menu_tree['content']) {
$output['content'] = '<ul class="nice-menu nice-menu-'. $direction .'" id="nice-menu-'. $id .'">'. $menu_tree['content'] .'</ul>'."\n";
$output['subject'] = $menu_tree['subject'];
}
}
return $output;
}
/**
* Theme primary links as nice menus
*
* @param $direction
* Optional. The direction the menu expands. Default is 'down'.
* @param $menu
* Optional. A custom menu array to use for theming --
* it should have the same structure as that returned
* by menu_tree_all_data(). Default is the standard menu tree.
* @return
* An HTML string of nice menu primary links.
*/
function theme_nice_menu_primary_links($direction = 'down', $menu = NULL) {
$menu_name = variable_get('menu_primary_links_source', 'primary-links');
$output = theme('nice_menu', 0, $menu_name, 0, $direction, $menu);
return $output['content'];
}
?>
und noch noch der CSS von nicemenu, welcher von mir ein wenig angepasst wurde
/* $Id: nice_menus_default.css,v 1.6 2007/10/29 16:38:28 add1sun Exp $ */
/*
This is the default layout template for nice menus, and will provide
a starting point for the look of your menus. To customize, it's
recommended to create a custom CSS file using this file as a template,
then configure the module to use your custom CSS file
(this is done in the global settings tab of the theme administration.)
To help understand the CSS, the HTML looks like this, where
x is a number;
TYPE is down/left/right;
PATH is the menu path such as node/343;
MID is the menu id such as 33):
<ul id='nice-menu-x' class='nice-menu nice-menu-TYPE'>
<li id='menu-MID' class='menu-path-PATH'><a href='#'>This is a menu item</a></li>
<li class='menuparent menu-path-PATH'><a href='#'>A submenu</a>
<ul...><li...>...</li>
</ul>
</li>
...
</ul>
If you have more than one nice-menu and want to target a particular one,
use its id (e.g. ul#nice-menu-2).
See README.txt and the handbook page (http://drupal.org/node/185543)
for some CSS customization examples.
*/
/******************************
Global CSS for ALL menu types
******************************/
ul.nice-menu,
ul.nice-menu ul {
list-style: none;
padding: 0;
margin: 0px;
}
ul.nice-menu li {
border-top: 0;
float: left;
background-color: #FF00FF;
/* Additional overrides to deal with Garland theme. */
margin: 0px;
padding-left: 0px;
width: 258px;
height: 17px;
background: url(images/menu_home.gif) right center no-repeat;
}
/* Overrides for Garland header. */
#header-region ul.nice-menu li {
margin: 0;
/* Padding rules are needed to deal with Garland's header line-height. */
padding-top: 0.1em;
padding-bottom: 0.1em;
background: #eee;
}
/*schrift verändern in höhe line-height: 2;*/
ul.nice-menu a {
padding: 0.3em 5px 0.3em 5px;
}
ul.nice-menu ul,
/* Repeat for Garland header. */
#header-region ul.nice-menu ul {
top: 1.75em;
left: -1px;
border: 0;
margin-right: 0;
}
/* Override for Garland header. */
#header-region ul.nice-menu ul {
top: 1.7em;
}
/*zeilenabstand*/
ul.nice-menu ul li {
width: 268px;
height: 15px;
}
/******************************
VERTICAL (left/right) menus
******************************/
/* This is the default width of all vertical menus. */
ul.nice-menu-right, ul.nice-menu-left,
ul.nice-menu-right li, ul.nice-menu-left li {
width: 12.5em;
}
/* VERTICAL menus where submenus pop RIGHT (default). */
ul.nice-menu-right ul {
width: 12.5em;
left: 12.5em;
top: -1px;
}
ul.nice-menu-right ul ul {
width: 12.5em;
left: 12.5em;
top: -1px;
}
ul.nice-menu-right li.menuparent,
ul.nice-menu-right li li.menuparent {
background: #eee url(arrow-right.png) right center no-repeat;
}
ul.nice-menu-right li.menuparent:hover,
ul.nice-menu-right li.over,
ul.nice-menu-right li li.menuparent:hover,
ul.nice-menu-right li li.over {
background: #ccc url(arrow-right.png) right center no-repeat;
}
/* VERTICAL menus where submenus pop LEFT. */
ul.nice-menu-left li ul {
width: 12.5em;
left: -12.65em;
top: -1px;
}
ul.nice-menu-left li ul li ul {
width: 12.5em;
left: -12.65em;
top: -1px;
}
ul.nice-menu-left li.menuparent,
ul.nice-menu-left li li.menuparent {
background: #eee url(arrow-left.png) left center no-repeat;
}
ul.nice-menu-left li.menuparent:hover,
ul.nice-menu-left li.over,
ul.nice-menu-left li li.menuparent:hover,
ul.nice-menu-left li li.over {
background: #ccc url(arrow-left.png) left center no-repeat;
}
ul.nice-menu-left a, ul.nice-menu-left ul a {
padding-left: 14px;
}
/******************************
HORIZONTAL (down) menus
******************************/
ul.nice-menu-down {
float: left;
border: 0;
}
ul.nice-menu-down li {
}
ul.nice-menu-down li li {
border-top: 0;
}
ul.nice-menu-down ul {
left: 0;
}
ul.nice-menu-down ul li {
clear: both;
}
ul.nice-menu-down li ul li ul,
/* Repeat for Garland header. */
/*sekundärlinks ändern 12.5em */
#header-region ul.nice-menu-down li ul li ul {
left: 12.5em;
top: -1px;
}
/*mneuschrift linls rechts*/
ul.nice-menu-down .menuparent a {
padding-right: 15px;
}
ul.nice-menu-down li.menuparent,
/* Repeat for Garland header. */
#header-region ul.nice-menu-down li.menuparent {
background: url(images/dropdown_menu_01.jpg) right center no-repeat;
font-weight: bold;
color: #FFFFFF;
width: 130px;
height: 20px;
text-align: center;
}
ul.nice-menu-down li.menuparent:hover,
ul.nice-menu-down li.over,
/* Repeat for Garland header. */
#header-region ul.nice-menu-down li.menuparent:hover,
#header-region ul.nice-menu-down li.over {
background: url(images/dropdown_menu_01.jpg) right center no-repeat;
}
ul.nice-menu-down li li.menuparent,
/* Repeat for Garland header. */
#header-region ul.nice-menu-down li li.menuparent {
width: 258px;
height: 17px;
background: url(images/menu_home.gif) right center no-repeat;
padding-right: 10px;
}
ul.nice-menu-down li li.menuparent:hover,
ul.nice-menu-down li li.over,
/* Repeat for Garland header. */
#header-region ul.nice-menu-down li li.menuparent:hover,
#header-region ul.nice-menu-down li li.over {
width: 258px;
height: 17px;
background: url(images/menu_home.gif) right center no-repeat;
}
so ich hoffe mal, dass mir jemand weiterhelfen kann
schon mal vielen Dank für eure Hilfe
Mit freundlichen Grüßen
hellermann
- Anmelden oder Registrieren um Kommentare zu schreiben
kann mir nimand helfen?
am 04.08.2008 - 16:38 Uhr
kann mir nimand helfen?
Wenn die Seite mit dem Nice
am 04.08.2008 - 16:49 Uhr
Wenn die Seite mit dem Nice Menue online ist poste bitte die URL.
Schmink Dir ab in der Moduldatei Code zu aendern.
Dafuer gibt es mehrere Themefunktionen im Modul - damit sollte man rankommen an eventuell notwendige Codeaenderungen. Und diese dann in Templates oder der "template.php".
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Da geht noch was.
hi die page ist leider noch
am 04.08.2008 - 16:54 Uhr
hi die page ist leider noch local
ist es auch verständlich was ich brauche?
Kannst Du in den DVC kommen?
am 04.08.2008 - 17:14 Uhr
Ich verstehe was Du moechtest.
Kannst Du in den DVC kommen?
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Da geht noch was.
so jop bin da
am 04.08.2008 - 17:33 Uhr
so jop bin da
hellermann schrieb so jop
am 04.08.2008 - 17:37 Uhr
so jop bin da
Wo bist Du denn? Ich sehe Dich nicht.
DVC = Drupal Voice Channel
(Dazu benoetigst Du Mumble.)
-------------
quiptime
Nur tote Fische schwimmen mit dem Strom.
Da geht noch was.
jop mumble-tower.de oder?
am 04.08.2008 - 17:39 Uhr
jop
mumble-tower.de oder? port: 64748