| | | |  |  | |  |
27.09.2005, 19:25
|
#1 (permalink)
| | Baby Mamber
Join Date: Feb 2005
Posts: 19
| Submenu with mycssmenu.php I'm using a template which uses mycssmenu.php for the menu. The primary menu-items are working perfectly, but the submenu is crap (menu moves up, text "jml" appears and most submenu-items don't become colored when active) Look at http//: www.nicojans.tk and click on "competenties" and you see what I mean.
Can some-one help me out here?
Template's index.php: PHP Code: <?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
require($mosConfig_absolute_path."/templates/recipes8/mycssmenu.php");
?><?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// needed to seperate the ISO number from the language file constant _ISO
$iso = explode( '=', _ISO );
// xml prolog
echo '<?xml version="1.0" encoding="'. $iso[1] .'"?' .'>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
if ( $my->id ) {
initEditor();
}
?><?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
require($mosConfig_absolute_path."/templates/recipes8/mycssmenu.php");
?>
<meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
<?php mosShowHead(); ?>
<link rel="stylesheet" type="text/css" href="<?php echo $mosConfig_live_site; ?>/templates/recipes8/css/template_css.css" />
</head>
<body>
<center><table colspan="0" cellspacing="0" border="0" width="711">
<tr>
<td id="header"><img src="<?php echo $mosConfig_live_site; ?>/templates/recipes8/images/blank.gif" width="711" height="180">
<div id="example9h">
<!-- BEGIN MENU -->
<div class="navhorzcontainer">
<div class="navsubhorzcontainer">
<?php echo $mycssPRI_SUB_LAYERED ?></div>
</div>
<!-- END MENU -->
<br>
</td>
</tr>
<tr>
<td valign="top" id="main">
<?php mosMainBody(); ?>
</div></td>
</tr>
<tr>
<td id="footer"></div></td>
</tr>
</table></center
</body>
</html> |
| |
27.09.2005, 19:26
|
#2 (permalink)
| | Baby Mamber
Join Date: Feb 2005
Posts: 19
| Re: Submenu with mycssmenu.php mycssmenu.php: PHP Code: <?php /* mycssmenu.php based on mod_mainmenu.class.php,v 1.13 */
/**
* recoded by Konlong
* produces two variable strings in unordered list format
* $mycssONLY_PRI_menu => just the top level items of the menu
* $mycssPRI_SUB_menu => menus with submenu list (nested)
*
*
* One variable string with the primary unordered list first followed by any sub-menu lists
* $mycssPRI_SUB_LAYERED => menus with submenu list (layered)
*
*
* And a simple string of links separated with "::"
* $mycssPATHmenu => just the top level items of the menu with a separator "::" between items
*
*NOTE: ONLY "$mycssPRI_SUB_LAYERED" Is wrapped in a division tag '<div id="navhorzcontainer">' for
* primary levels and '<div id="navsubhorzcontainer">' for the sub-levels.
* The other variables are divisionless
* and it is up to the template designer to assign a division.
*
* The id's used are :
*
* <ul id="navlist"> for Primary levels
* <li id="active"> for active or chosen item on a Primary level
* <ul id="subnavlist"> for Sub levels
* <li id="subactive"> for active or chosen item on a Sub level
*
* This file sould be placed in your templates own directory
* & the following should be at the top of your index.php
*
* <?php
* defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
* require($mosConfig_absolute_path."/templates/XXXXXX/mycssmenu.php");
* ?>
*
* NOTE: replace 'XXXXXX' with the name of your template
*
**/
/* $Id: mod_mainmenu.class.php,v 1.13 2004/01/13 20:36:55 ronbakker Exp $ */
/**
* Menu handling functions
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.13 $
**/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
if (defined( '_VALID_MYCSSMENU' )) return;
/**
* Menu List
*/
global $database, $my, $cur_template, $Itemid;
global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_shownoauth;
$menutype = @$params->menutype ? $params->menutype : 'mainmenu';
$class_sfx = @$params->class_suffix ? $params->class_suffix : '';
$mycssONLY_PRI_menu = "\n";
$mycssPRI_SUB_menu = "\n";
$mycssPRI_SUB_LAYERED = "\n";
$PRI_SUB_LAYERED = array();
$PRI_SUB_LAYERED[0] = "\n".'<div id="navhorzcontainer">';
$mycssPATHmenu = "";
/* If a user has signed in, get their user type */
$intUserType = 0;
if($my->gid){
switch ($my->usertype)
{
case 'Super Administrator':
$intUserType = 0;
break;
case 'Administrator':
$intUserType = 1;
break;
case 'Editor':
$intUserType = 2;
break;
case 'Registered':
$intUserType = 3;
break;
case 'Author':
$intUserType = 4;
break;
case 'Publisher':
$intUserType = 5;
break;
case 'Manager':
$intUserType = 6;
break;
}
}
else
{
/* user isn't logged in so make their usertype 0 */
$intUserType = 0;
}
if ($mosConfig_shownoauth) {
$sql = "SELECT m.* FROM #__menu AS m"
. "\nWHERE menutype='$menutype' AND published='1'"
//. "\nAND utaccess >= '$intUserType' "
. "\nORDER BY parent,ordering";
} else {
$sql = "SELECT m.* FROM #__menu AS m"
. "\nWHERE menutype='$menutype' AND published='1' AND access <= '$my->gid'"
//. "\nAND utaccess >= '$intUserType' "
. "\nORDER BY parent,ordering";
}
$database->setQuery( $sql );
$rows = $database->loadObjectList( 'id' );
echo $database->getErrorMsg();
// establish the hierarchy of the menu
$children = array();
// first pass - collect children
foreach ($rows as $v ) {
$pt = $v->parent;
$list = @$children[$pt] ? $children[$pt] : array();
array_push( $list, $v );
$children[$pt] = $list;
}
// second pass - collect 'open' menus
$open = array( $Itemid );
$count = 20; // maximum levels - to prevent runaway loop
$x_id = $Itemid;
while (--$count) {
if (isset($rows[$x_id]) && $rows[$x_id]->parent > 0) {
$x_id = $rows[$x_id]->parent;
$open[] = $x_id;
} else {
break;
}
}
cssRecurseMenu( 0, 0, $children, $open, $class_sfx, $mycssONLY_PRI_menu, $mycssPRI_SUB_menu, $PRI_SUB_LAYERED, $mycssPATHmenu );
$mycssHORZmenu_content = $mycssONLY_PRI_menu .= "\n";
$mycssVIRTmenu_content = $mycssPRI_SUB_menu .= "\n";
$PRI_SUB_LAYERED[0] .= "\n".'</div>jml';
$mycssHORZwSUBmenu_content = $mycssPRI_SUB_LAYERED .= implode("\n", $PRI_SUB_LAYERED) ."\n";
$mycssPATHmenu_content = $mycssPATHmenu = substr($mycssPATHmenu,0,strlen($mycssPATHmenu)-4);
define( '_VALID_MYCSSMENU', true );
/**
* Utility function to recursively work through a hierarchial menu
*/
function cssRecurseMenu( $p_id, $level, &$children, &$open, $class_sfx, &$navOnlyPrimary, &$navPrimary_Subs, &$navPrimary_Sub_layered, &$navPATH) {
global $Itemid;
if (@$children[$p_id]) {
if ($level)
{
$navPrimary_Subs .= "\n".'<ul id="subnavlist">';
$navPrimary_Sub_layered[$level] = "\n".'<div id="navsubhorzcontainer"><ul id="navlist">';
} else
{
$navPrimary_Subs .= "\n".'<ul id="navlist">';
$navOnlyPrimary .= "\n".'<ul id="navlist">';
$navPrimary_Sub_layered[$level] .= "\n".'<ul id="navlist">';
}
foreach ($children[$p_id] as $row) {
$idclass = '';
$navPrimary_Subs .= "\n<li";
$navPrimary_Sub_layered[$level] .= "\n<li";
if (!$level)
{
$navOnlyPrimary .= "\n<li";
}
if ($Itemid == $row->id)
{
if ($level)
{
$navPrimary_Subs .= ' id="subactive"';
$idclass = 'id="subcurrent"';
$navPrimary_Sub_layered[$level] .= 'id="subactive"';
} else
{
$navPrimary_Subs .= ' id="active"';
$navOnlyPrimary .= ' id="active"';
$navPrimary_Sub_layered[$level] .= ' id="active"';
$idclass = 'id="current"';
}
}
$navPrimary_Subs .= '>';
$navPrimary_Sub_layered[$level] .= '>';
if (!$level)
{
$navOnlyPrimary .= ">";
}
// $nav_cont .= (in_array( $row->id, $open ) ? '-X-': ''); //testing code
if (in_array( $row->id, $open ))
{
$navPATH .= $row->name . ' :: ';
}
$navLink = cssGetMenuLink( $row, $level, $class_sfx, $idclass);// id_class no used at present all anchor classes set to images
$navPrimary_Subs .= $navLink.'</li>';
$navPrimary_Sub_layered[$level] .= $navLink.'</li>';
if (!$level)
{
$navOnlyPrimary .= $navLink.'</li>';
}
if (in_array( $row->id, $open )) {
cssRecurseMenu( $row->id, $level+1, $children, $open, $class_sfx, $navOnlyPrimary, $navPrimary_Subs, $navPrimary_Sub_layered, $navPATH);
}
}
$navPrimary_Subs .= "\n</ul>";
$navPrimary_Sub_layered[$level] .= "\n</ul>\n</div>";
if (!$level)
{
$navOnlyPrimary .= "\n</ul>";
}
}
}
/**
* Utility function for writing a menu link
*/
function cssGetMenuLink( $mitem, $level=0, $class_sfx='', $idclass='') {
// id_class no used at present all anchor classes set to images
global $Itemid, $mosConfig_live_site;
$txt = '';
switch ($mitem->type) {
case 'separator';
// do nothing
break;
case 'url':
if (eregi( "index.php\?", $mitem->link )) {
//$mitem->link .= "&Returnid=$Itemid";
if (!eregi( "Itemid=", $mitem->link )) {
$mitem->link .= "&Itemid=$mitem->id";
}
}
break;
default:
$mitem->link .= "&Itemid=$mitem->id";
break;
}
$mitem->link = str_replace( '&', '&', $mitem->link );
if (strcasecmp(substr($mitem->link,0,4),"http")) {
$mitem->link = sefRelToAbs($mitem->link);
}
$menuclass = "mainlevel$class_sfx";
if ($level > 0) {
$menuclass = "sublevel$class_sfx";
}
$menuclass = "images";
switch ($mitem->browserNav) {
// cases are slightly different
case 1:
// open in a new window
$txt = "<a href=\"$mitem->link\" target=\"_window\" class=\"$menuclass\" $idclass>$mitem->name</a>";
break;
case 2:
// open in a popup window
$txt = "<a href=\"#\" onClick=\"javascript: window.open('$mitem->link', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\" $idclass>$mitem->name</a>";
break;
case 3:
// don't link it
$txt = "<span class=\"$menuclass\" $idclass>$mitem->name</span>";
break;
default: // formerly case 2
// open in parent window
$txt = "<a href=\"$mitem->link\" class=\"$menuclass\" $idclass>$mitem->name</a>";
break;
}
return $txt;
}
?> |
| |
27.09.2005, 19:27
|
#3 (permalink)
| | Baby Mamber
Join Date: Feb 2005
Posts: 19
| Re: Submenu with mycssmenu.php Template's css: PHP Code: /* horizontale menu */
#example9h #navlist
{
margin-left: 70px;
margin-right: 70px;
text-align:center;
font: bold 10px Verdana, sans-serif;
letter-spacing: 1px;
}
#example9h #navlist li
{
list-style: none;
margin: 0;
display: inline;
padding-left:10px;
line-height:18px;
}
#example9h #navlist li a
{
text-decoration:none;
}
#example9h #navlist li a:link { color: #666; }
#example9h #navlist li a:visited { color: #666; }
#example9h #navlist li a:hover
{
color: #ccc;
border-top:1px solid #ccc;
border-bottom:1px solid #ccc;
}
#example9h #navlist li a:current
{
border-top:1px solid #4A788C;
border-bottom:1px solid #4A788C;
color: #4A788C;
}
#example9h #subnavlist
{
margin-left: 70px;
margin-right: 70px;
text-align:center;
font: bold 10px Verdana, sans-serif;
letter-spacing: 1px;
}
#example9h #subnavlist li
{
list-style: none;
margin: 0;
display: inline;
padding-left:10px;
line-height:18px;
}
#example9h #subnavlist li a
{
text-decoration:none;
}
#example9h #subnavlist li a:link { color: #666; }
#example9h #subnavlist li a:visited { color: #666; }
#example9h #subnavlist li a:hover
{
color: #ccc;
border-top:1px solid #ccc;
border-bottom:1px solid #ccc;
}
#example9h #subnavlist li a:current
{
border-top:1px solid #4A788C;
border-bottom:1px solid #4A788C;
color: #4A788C;
}
body {
margin: 0px;
background: url(../images/recipes_01.gif) repeat-x #91C1D6;
}
#main{
background: url(../images/recipes_06.gif) repeat-y;
width:711px;
padding-left:70px;
padding-right:70px;
}
#header{
background: url(../images/recipes_03.gif) no-repeat;
width: 711px;
height: 245px;
}
#footer{
background: url(../images/recipes_08.gif) no-repeat;
padding-top:3px;
height: 51px;
}
td,tr,p, div{
font-family: arial;
font-size: 11px;
color: #222222;
}
hr {
background : #999999;
height : 1px;
width : 100%;
}
#mainlevel-nav {
margin: 0; padding: 0;
padding-left:50px;
}
#mainlevel-nav li {
padding-left: 40px;
list-style:none; display:inline;
text-transform: uppercase;
font-weight: bold;
text-decoration:none;
}
#mainlevel-nav a {
border: 3px #fff;
height: 20px;
color: #000;
}
#mainlevel-nav a:hover {
color:#ccc
text-transform:none;
height: 20px;
background: url(../images/mouseover.gif) no-repeat;
}
/*different setting for newsflash*/
.newsflash td {
color: #000000;
text-align: justify;
vertical-align: middle;
}
/*setting for the greetings*/
.mainpage {
text-align: justify;
color: #333333;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 13px;
}
.mainpage-bkg {
background-image: url(../images/lineborder.png);
width: 1px;
}
.greybg {
background: #eeeeee;
}
/*pathway setting*/
.pathway {
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 9px;
}
a.pathway:link, a.pathway:visited {
color : #4A788C;
font-weight : normal;
}
a.pathway:hover {
color : #ff3300;
font-weight : normal;
text-decoration : none;
}
/*for title or site name*/
.title {
font-family: sans-serif;
font-size: 20px;
font-weight: bold;
color : #000000;
margin-left: 10px;
}
/*for the tag-line*/
.subtitle {
font-family: sans-serif;
font-size: 10px;
font-weight: bold;
color : #666666;
text-transform: uppercase;
letter-spacing: 2px;
margin-left: 20px;
}
#active_menu {
color: #000000;
}
/* --Default Class Settings-- */
a.mainlevel:link, a.mainlevel:visited {
display: block;
color: #ffffff;
font-weight: bold;
background-image: url(../images/menu_bgr.png);
background-repeat: no-repeat;
width: 95%;
text-indent: 15px;
text-decoration: none;
font-family: Verdana, Helvetica, Arial, sans-serif;
line-height: 20px;
margin-bottom: 1px;
}
a.mainlevel:hover {
color: #333333;
}
a.mainmenu:link, a.mainmenu:visited {
color: #ffffff;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 10px;
}
a.mainmenu:hover {
color: #333333;
}
.pollstableborder {
border: 1px solid;
padding: 1px;
}
a.sublevel:link, a.sublevel:visited {
padding-left: 1px;
vertical-align: middle;
font-size: 11px;
color: #4A788C;
text-align: left;
}
a.sublevel:hover {
color: #ff9e31; text-decoration: none;
}
table.moduletable {
padding: 5px 0px 5px 8px;
margin-bottom: 15px;
width: 100%;
background: url(../images/bgr.png);
}
table.moduletable th {
font-size : 11px;
font-weight : bold;
color : #000000;
text-align : left;
width : 100%;
letter-spacing: 2px;
text-indent: 5px;
padding-bottom: 3px;
}
table.moduletable li {
}
table.moduletable ul {
padding: 0px;
}
table.moduletable td {
font-size: 10px;
font-weight: normal;
}
.poll {
font-family : Arial, Helvetica, sans-serif;
font-size : 10px;
color : #666666;
line-height : 14px;
}
table.pollstableborder {
border: 1px solid #cccccc;
}
.sectiontableheader {
color : #333333;
font-weight : bold;
}
.sectiontableentry1 {
background-color : #F0F0F0;
}
.sectiontableentry2 {
background-color : #E0E0E0;
}
.small {
font-family : Verdana, Arial, Helvetica, sans-serif;
font-size : 10px;
color : #999999;
text< | | | |