We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4753
    • 31 Posts
    Hallo,
    I’ve just downloaded v0.9.2.1 rev1005, the last installation an database structure was a v0.9.1 rev646.

    now i have a problem... nearby every page shows
    Fatal error: Cannot redeclare buildelement() (previously declared in Q:\HTPUBLIC\modx-0.9.2.1\manager\includes\document.parser.class.inc.php(705) : eval()’d code:63) in Q:\HTPUBLIC\modx-0.9.2.1\manager\includes\document.parser.class.inc.php(705) : eval()’d code on line 83
    and I can’t find the line where "buildelement()" is getting declared.

    Hope you can help me!
    greetings form germany,
    Christian
    • Christian, buildelement is in one of the snippets you have running on the page. Looks like two snippets are trying to declare the same function name; very bad snippets! They deserve a beating. smiley

      My guess is NewsListing and another snippet are in conflict using a function called buildelement(). Be aware that Newslisting and other snippets in the installation are not the latest versions, so if you didn’t uncheck the boxes to upgrade the snippets, you most likely overwrote some more recent versions of the core snippets with older versions.

      Hope that helps you sort out the issues.
        • 4753
        • 31 Posts
        Okay, it is my MenuBuilder... a very special MenuBuilder... it is based on the Etomite MenuBuilder but has many changes...

        But can you tell my why a
        if (!function_exists('buildElement') ) { ... }
        doesn’t work correctly and so this doesn’t solve the prob??
        • Quote from: CBieser at May 21, 2006, 06:18 PM

          Okay, it is my MenuBuilder... a very special MenuBuilder... it is based on the Etomite MenuBuilder but has many changes...

          But can you tell my why a
          if (!function_exists('buildElement') ) { ... }
          doesn’t work correctly and so this doesn’t solve the prob??

          Unfortunately not without seeing more of the code. I suspect, since it’s being reported as buildelement() and not buildElement(), this might have something to do with it???
            • 4753
            • 31 Posts
            Following the Snippet "MenuBuilderFHF"

            $id = isset($id) ? $id : $modx->documentIdentifier; // base document
            $indentString = 22;
            $CSS_class = "nav";
            $CSS_class_active = "navactive";
            $menu = '';
            
            // ----------------------------------------------------------------------
            
            if(!isset($indent)) {
                $indent = "";
                $indentString = 22;
                    $bgcolorString = "#003399";
            } else {
                for($in=0; $in<$indent; $in++) {
                    $indentString += 10;
                }
                switch ($indent) {
                        case 0:
                                $bgcolorString = "#003399";
                                break;
                        case 1:
                                $bgcolorString = "#728EC7";
                                break;
                        case 2:
                                $bgcolorString = "#CBD5EA";
                                break;
                        default:
                                $bgcolorString = "#728EC7";
                }
            }
            
            // ----------------------------------------------------------------------
            
            $children = $modx->getActiveChildren( $id, 'menuindex', 'ASC', 'id, pagetitle, menutitle, hidemenu' );
            $childrenCount = count($children);
            
            if($children == false) {
            	return false;
            }
            for($x=0; $x<$childrenCount; $x++) {
            	if($children[$x]["id"] == $modx->documentIdentifier) {
            	    $CSSclass = $CSS_class_active;
            	} // if
            	else {
            	    $CSSclass = $CSS_class;
            	} // else
            
                $parent_parentid = $modx->getParent($modx->documentObject['parent'], 1, $fields='id, parent');
            
                if ( !$children[$x]["hidemenu"] ) {
                    if( $children[$x]["id"] == $modx->documentIdentifier || $children[$x]["id"] == $modx->documentObject['parent'] || $children[$x]["id"] == $parent_parentid['id'] ) {
                        $indent++;
                        $menu .= buildElement ($children[$x]["menutitle"], $children[$x]["id"],$CSSclass ,$indentString, $bgcolorString ) .'[[MenuBuilderFHF?id=' .$children[$x]["id"] .'&indent=' .$indent .']]';
                    } else {
                        $menu .= buildElement ($children[$x]["menutitle"], $children[$x]["id"],$CSSclass ,$indentString, $bgcolorString );;
                    }
                }
            }
            return $menu;
            
            // ----------------------------------------------------------------------
            
            function buildElement ( $title, $a_href, $CSSclass = "", $extra1 = "", $extra2 = "", $extra3 = "" ) {
            	$menuElement = '
            <table bgcolor="'.$extra2.'" width="165" border="0" cellspacing="0" cellpadding="0">
              <tr>
                    <td height="20" width="' .$extra1 .'"><img src="[(base_url)]assets/templates/images/blank.gif" alt="" width="' .$extra1 .'" height="1" border="0"></td>
                    <td nowrap valign="top" width="10"><img src="[(base_url)]assets/templates/images/blank.gif" alt="" width="1" height="6" border="0"><br><a onMouseover="' ."ToggleImage('arrow_" .$a_href ."',1)" .'" onMouseout="' ."ToggleImage('arrow_" .$a_href ."',0)" .'" href="[~' .$a_href .'~]"><img id="arrow_' .$a_href .'" src="[(base_url)]assets/templates/images/arrow.gif" width="7" height="8" border="0" alt=""></a><img src="[(base_url)]assets/templates/images/blank.gif" width="3" height="1" border="0" alt=""></td>
                    <td valign="top" width="133"><img src="[(base_url)]assets/templates/images/blank.gif" alt="" width="1" height="2" border="0"><br><a onMouseover="' ."ToggleImage('arrow_" .$a_href ."',1)" .'" onMouseout="' ."ToggleImage('arrow_" .$a_href ."',0)" .'" class="' .$CSSclass .'" href="[~' .$a_href .'~]">' .$title .'</a><br><img src="[(base_url)]assets/templates/images/blank.gif" width="1" height="3" border="0" alt=""></td>
              </tr>
              <tr>
                    <td width="165" colspan="3">
                      <table style="background-image:url([(base_url)]assets/templates/images/dotted_line.gif)" width="165" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td><img src="[(base_url)]assets/templates/images/blank.gif" alt="" width="165" height="1" border="0"></td>
                            </tr>
                      </table>
                    </td>
              </tr>
            </table>
            ';
            	return $menuElement;
            }


            you can see the error at http://goethe-wg.no-ip.org/modx-0.9.2.1/
            try any of the documents listet in the menu and as the result you’ll see the error... try a link on the right (e.g. Sitemap) and it works fine...
            • Best solution is simply rename your function to mbBuildElement() or mb_buildelement() etc. to avoid the conflict altogether.
                • 4753
                • 31 Posts
                no, this changes nothing....
                • If you changed the name of your function in that snippet and are still getting this error, than I suspect there are two other snippet calls conflicting, and it’s not at all involved with your MenuBuilder snippet. Do you have two instances of NewsListing or any other snippets on the page?
                    • 4753
                    • 31 Posts
                    okay, now i’m using include_once and it works perfect...

                    thanks for your help!
                      • 4753
                      • 31 Posts
                      it seems that the problem depends on the system... on the live-debian system with php4 the problem didn’t occurs