Bulletmenu WITHOUT bullets?
Bulletmenu WITHOUT bullets?
Hi all,
I really do like CMS more everyday. But I have a question concerning the {bulletmenu}-Plug-In. It's perfect for what I wanna do, but I need it WITHOUT bullets, as a pure, clean text-menu, that I can change with CSS. I couldn't remove the bullets using CSS, so I guess I'll have to modify the plug-in itself. Can anybody help?
Thanks!
Alex
I really do like CMS more everyday. But I have a question concerning the {bulletmenu}-Plug-In. It's perfect for what I wanna do, but I need it WITHOUT bullets, as a pure, clean text-menu, that I can change with CSS. I couldn't remove the bullets using CSS, so I guess I'll have to modify the plug-in itself. Can anybody help?
Thanks!
Alex
Bulletmenu WITHOUT bullets?
This is what I use on cmsmadesimple.org. Copy this into plugins/function.simplemenu.php:
Then use it as {simplemenu} in your template/content. Keep in mind, that I'm not sure how it handles multiple levels, but it works wonderful for a 1 level menu.
Lemme know how it works for you. Thanks.
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function smarty_cms_function_simplemenu($params, &$smarty) {
global $gCms;
global $db;
# getting menu parameters
$showadmin = isset($params["showadmin"]) ? $params["showadmin"] : 1 ;
$allcontent = ContentManager::GetAllContent();
# defining variables
$menu = "";
$last_level = 0;
$count = 0;
$in_hr = 0;
if (count($allcontent))
{
$menu .= "<div class=\"simplemenu\">\n";
foreach ($allcontent as $onecontent)
{
#Handy little trick to figure out how deep in the tree we are
#Remember, content comes to use in order of how it should be displayed in the tree already
$depth = count(split('\.', $onecontent->Hierarchy()));
#If hierarchy starts with the start_element (if it's set), then continue on
if (isset($params['start_element']))
{
if (!(strpos($onecontent->Hierarchy(), $params['start_element']) !== FALSE && strpos($onecontent->Hierarchy(), $params['start_element']) == 0))
{
continue;
}
}
#Now check to make sure we're not too many levels deep if number_of_levels is set
if (isset($params['number_of_levels']))
{
$number_of_levels = $params['number_of_levels'] - 1;
$base_level = 1;
#Is start_element set? If so, reset the base_level to it's level
if (isset($params['start_element']))
{
$base_level = count(split('\.', $params['start_element']));
}
#If this element's level is more than base_level + number_of_levels, then scratch it
if ($base_level + $number_of_levels < $depth)
{
continue;
}
}
if (!$onecontent->Active() || !$onecontent->ShowInMenu())
{
continue;
}
if ($onecontent->Type() == 'sectionheader')
{
if ($in_hr == 1)
{
#$menu .= "</ul>\n";
$in_hr = 0;
}
$menu .= "<div class=\"sectionheader\">".$onecontent->MenuText()."</div>\n";
if ($count > 0 && $in_hr == 0)
{
#$menu .= "<ul>\n";
$in_hr = 1;
}
}
else
{
if ($depth < $last_level) {
for ($i = $depth; $i < $last_level; $i++) $menu .= "\n";
if ($depth > 0)
{
$menu .= "\n";
}
}
if ($depth > $last_level) {
for ($i = $depth; $i > $last_level; $i--) $menu .= "\n";
}
if ($depth == $last_level) {
$menu .= "\n";
}
if ($onecontent->Type() == 'separator')
{
$menu .= "<hr class=\"separator\"/>";
}
else
{
$menu .= "<a href=\"".$onecontent->GetURL()."\"";
if (isset($gCms->variables['page_id']) && $onecontent->Id() == $gCms->variables['page_id'])
{
$menu .= " class=\"currentpage\"";
}
$menu .= ">".$onecontent->MenuText()."</a>";
}
$in_hr = 1;
$last_level = $depth;
}
$count++;
}
#for ($i = 0; $i < $last_level; $i++) $menu .= "</ul>";
:
if ($showadmin == 1)
{
$menu .= "<a href='admin/'>Admin</a>\n";
}
$menu .= "</div>\n";
}
return $menu;
}
function smarty_cms_help_function_simplemenu() {
?>
<h3>What does this do?</h3>
<p>Prints a bullet menu.</p>
<h3>How do I use it?</h3>
<p>Just insert the tag into your template/page like: <code>{simplemenu}</code></p>
<h3>What parameters does it take?</h3>
<p>
<ul>
<li><em>(optional)</em> <tt>showadmin</tt> - 1/0, whether you want to show or not the admin link.</li>
<li><em>(optional)</em> <tt>start_element</tt> - the hierarchy of your element (ie : 1.2 or 3.5.1 for example). This parameter sets the root of the menu.</li>
<li><em>(optional)</em> <tt>number_of_levels</tt> - an integer, the number of levels you want to show in your menu.</li>
</ul>
</p>
<?php
}
function smarty_cms_about_function_simplemenu() {
?>
<p>Author: Julien Lancien<calexico@cmsmadesimple.org></p>
<p>Version: 1.0</p>
<p>
Change History:<br/>
None
</p>
<?php
}
# vim:ts=4 sw=4 noet
?>
Lemme know how it works for you. Thanks.
Bulletmenu WITHOUT bullets?
Got an error in line 157 took out the :
phplayers menu javascript still loading with this menu - weird??
Changed the code a bit to include
phplayers menu javascript still loading with this menu - weird??
Changed the code a bit to include
Now I can use CSS to style the menu like the examples on Maxdesign\n";
foreach ($allcontent as $onecontent)
{
#Handy little trick to figure out how deep in the tree we are
#Remember, content comes to use in order of how it should be displayed in the tree already
$depth = count(split('\.', $onecontent->Hierarchy()));
#If hierarchy starts with the start_element (if it's set), then continue on
if (isset($params['start_element']))
{
if (!(strpos($onecontent->Hierarchy(), $params['start_element']) !== FALSE && strpos($onecontent->Hierarchy(), $params['start_element']) == 0))
{
continue;
}
}
#Now check to make sure we're not too many levels deep if number_of_levels is set
if (isset($params['number_of_levels']))
{
$number_of_levels = $params['number_of_levels'] - 1;
$base_level = 1;
#Is start_element set? If so, reset the base_level to it's level
if (isset($params['start_element']))
{
$base_level = count(split('\.', $params['start_element']));
}
#If this element's level is more than base_level + number_of_levels, then scratch it
if ($base_level + $number_of_levels Active() || !$onecontent->ShowInMenu())
{
continue;
}
if ($onecontent->Type() == 'sectionheader')
{
if ($in_hr == 1)
{
$menu .= "\n\n";
$in_hr = 0;
}
$menu .= "".$onecontent->MenuText()."\n";
if ($count > 0 && $in_hr == 0)
{
$menu .= "";
$in_hr = 1;
}
}
else
{
if ($depth 0)
{
$menu .= "\n\n";
}
}
if ($depth > $last_level) {
for ($i = $depth; $i > $last_level; $i--) $menu .= "\n";
}
if ($depth == $last_level) {
$menu .= "\n";
}
if ($onecontent->Type() == 'separator')
{
$menu .= "";
}
else
{
$menu .= "GetURL().""";
if (isset($gCms->variables['page_id']) && $onecontent->Id() == $gCms->variables['page_id'])
{
$menu .= " class="currentpage"";
}
$menu .= ">".$onecontent->MenuText()."";
}
$in_hr = 1;
$last_level = $depth;
}
$count++;
}
for ($i = 0; $i ";
if ($showadmin == 1)
{
$menu .= "\nAdmin\n";
}
$menu .= "\n";
}
return $menu;
}
function smarty_cms_help_function_simplemenu() {
?>
What does this do?
Prints a bullet menu.
How do I use it?
Just insert the tag into your template/page like: {simplemenu}
What parameters does it take?
(optional) showadmin - 1/0, whether you want to show or not the admin link.
(optional) start_element - the hierarchy of your element (ie : 1.2 or 3.5.1 for example). This parameter sets the root of the menu.
(optional) number_of_levels - an integer, the number of levels you want to show in your menu.
Author: Julien Lancien<calexico@cmsmadesimple.org>
Version: 1.0
Change History:
None
Greg
Bulletmenu WITHOUT bullets?
Here is some CSS to go with this menu

.simplemenu { width: 140px; }
.simplemenu .sectionheader{
width: 140px;
margin: 0;
padding: 3px 10px 3 px 3px;
background-color: #aa0000;
color: #fff;
}
.simplemenu ul
{
margin: 0;
padding-left: 0;
list-style-type: none;
font-family: Arial, Helvetica, sans-serif;
}
.simplemenu a
{
display: block;
padding: 3px 3px 3px 10px;
width: 140px;
background-color: #036;
border-bottom: 1px solid #eee;
}
.simplemenu a:link, .simplemenu a:visited
{
color: #EEE;
text-decoration: none;
}
.simplemenu a:hover
{
background-color: #369;
color: #fff;
}

Greg
Bullets back in?
Hello wishy,
thanx for the script, but I also got the error message.
@Greg: like your script too, but you brought the bullets back in, that I wanted out. What should I do? Can someone fix Wishy's script?
thanx for the script, but I also got the error message.
@Greg: like your script too, but you brought the bullets back in, that I wanted out. What should I do? Can someone fix Wishy's script?
error message
Sorry, forgot to include it. Here's the message:
Underneath, the page would still show, but without the menu...[/quote]Parse error: parse error in /data/homewww/isuew/webdir/cms/plugins/function.simplemenu.php on line 127
Warning: Smarty error: [in db:1 line 49]: syntax error: custom function 'simplemenu' is not implemented (Smarty_Compiler.class.php, line 779) in /data/homewww/isuew/webdir/cms/lib/smarty/Smarty.class.php on line 1088
Bulletmenu WITHOUT bullets?
You can use CSS to eliminate the bullets just set the margin and padding to 0 in the .simplemenu ul class
Greg
Bulletmenu WITHOUT bullets?
I've got the code for switchmenu working on my local setup using the javascript from here:
getElemenybyID
and a modified simplemenu by wishy.
However, the template still loads the PHPLayers menu javascript files
Is there any way to eliminate the loading of the PHPLayers javascript?
getElemenybyID
and a modified simplemenu by wishy.
However, the template still loads the PHPLayers menu javascript files
This causes javascript errors as numl is not defined.layersmenu-browser_detection.js
layersmenu-library.js
layersmenu.js
Is there any way to eliminate the loading of the PHPLayers javascript?
Greg
Bulletmenu WITHOUT bullets?
Any other ways ?
I wanted to use both menus on the website (different pages of course).
We always want everything to work together
Maybe I'll have to define the variables in the switchmenu javascript that cause the errors.
The menu functions fine - just shows javascripts that relate to phplayers javascript code.
Wishy, don't spend any time on this as it is no big deal!
I wanted to use both menus on the website (different pages of course).
We always want everything to work together

Maybe I'll have to define the variables in the switchmenu javascript that cause the errors.
The menu functions fine - just shows javascripts that relate to phplayers javascript code.
Wishy, don't spend any time on this as it is no big deal!
Greg
Bulletmenu WITHOUT bullets?
There is probably not going to be a way to do that until I get around to writing the template parser needed for multiple content types. In other words, not anytime soon. 
