Page 1 of 1

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 9:30 am
by piratos
Bulletmenu makes XHTML - Erros - see what i mean:

Code: Select all

Original

<ul>
<li><a href="http://localhost/simple/index.php?page=cms-install-successful-">Home Page</a></li>
<ul>
<li><a href="http://localhost/simple/index.php?page=frequently-asked-questions">FAQ</a></li>
<li><a href="http://localhost/simple/index.php?page=contact-us">Contact Us</a></li>
<hr class="separator"/>
<li><a href="http://localhost/simple/index.php?page=svn-cvs-">SVN (cvs)</a></li>
</ul></ul><ul><li><a href='admin'>Admin</a></li></ul>

Separators causes XHTML Errors. incorrect nested ul and li causes XHTML Errors

This works correct but without separator

<ul>
<li><a href="http://localhost/simple/index.php?page=cms-install-successful-">Home Page</a><ul>
<li><a href="http://localhost/simple/index.php?page=frequently-asked-questions">FAQ</a></li>
<li><a href="http://localhost/simple/index.php?page=contact-us">Contact Us</a></li>
<li><a href="http://localhost/simple/index.php?page=svn-cvs-">SVN (cvs)</a></li>
</ul></li>
</ul><ul><li><a href='admin'>Admin</a></li></ul>

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 9:32 am
by Ted
Yeah, that's definatly a problem. Do you see a better way to do it so that it is xhtml compliant? I'm taking suggestions. :)

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 11:22 am
by piratos
That is my solution:

Code: Select all

Changes in file function.bulletmenu.php

1. Define bulletpic with link to a bulletimage whatever you want

define('bulletpic', 'plugins/images/pointer.gif');

2. Change the sourcecode as follow

Changes in function smarty_cms_function_bulletmenu

$blank = -1;

	foreach ($content as $one) {

		if ($one->page_type == "sectionheader")
		{
			if ($in_hr == 1)
			{	
				$in_hr = 0;
			}
			$menu .= "<div class=\"sectionheader\">".$one->menu_text."</div>\n";
			if ($count > 0 && $in_hr == 0)
			{
				$blank++;
				$in_hr = 1;
			}
		}
		else
		{
			if ($one->level < $last_level) {
				for ($i = $one->level; $i < $last_level; $i++)
				{	
					if ($blank>0)
					{
					$menu .= str_repeat(" ",$blank)."\n";
					$blank--;
					};
				};
			}
			if ($one->level > $last_level) {
				for ($i = $one->level; $i > $last_level; $i--)
				{
				 if ($blank>0) $menu .= str_repeat(" ",$blank)."\n";
				 $blank++;
				}
			}
			if ($one->page_type == "separator")
			{
				$menu .= "<hr class=\"separator\"/>\n";
			}
			else
			{
				$menu .= str_repeat(" ",$blank)."<img src=\"".bulletpic."\" alt=\"\" /><a href=\"".$one->url."\"> ".$one->menu_text."</a><br />\n";
			}
			$in_hr = 1;
			$last_level = $one->level;
		}
		$count++;
	}

	for ($i = 0; $i < $last_level; $i++) if ($blank>0) $blank--;

	if ($showadmin == 1) {
		$blank++;
		if ($blank>0)
		{
		$menu .= str_repeat(" ",$blank)."<img src=\"".bulletpic."\" alt=\"\" /> <a href='admin'>Admin</a>\n";
		$blank--;
		}
		else
		{$menu .= "<img src=\"".bulletpic."\" alt=\"\" /> <a href='admin'>Admin</a>\n";};
		
	}

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 11:41 am
by Ted
Cool. Though, I'm not totally convinced that it is the way to go, since you can change to bullet of a ul tag with CSS. Maybe I'm just missing something...

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 12:17 pm
by piratos
ul and li are in my solution never used, so it is useless to present a bulletimage via css.

There ist no sulution with ul and li if separator is a feature.

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 12:27 pm
by Ted
Hmm... Yeah, I guess you're right. Only thing that really stinks about it is that you can't modify the indentation or anything.

Maybe we should add this as a separate menu? Call it picturemenu or something? I personally don't mind just changing it, but at the same point, I don't want to break anyone's site with backwards compatibility issues.

bulletmenu and XHTML Errors

Posted: Fri Sep 24, 2004 12:57 pm
by piratos
Do what you want or you mean it's right.

What about pitbullmenu :lol: picbullmenu ??