Elxis CMS Forum

Support => Administration => Topic started by: xenios on March 07, 2008, 00:00:54

Title: Top module[SOLVED]
Post by: xenios on March 07, 2008, 00:00:54
Hello,

i changed the mod_mainmenu  code between the lines  256-278 because i couldn't use my top menu right....

I used the code of 2006.4 mod_mainmenu and it worked fine.

BUT I DON'T KNOW IF THIS IS BAD FOR THE REST OF ELXIS USE........


this was the change:
from this

      $menuclass = 'mainlevel'.$params->get( 'class_sfx' );
        if (count( $links )) {
         switch ($style) {
            case 1:
            echo '<ul id="'. $menuclass .'">';
            foreach ($links as $link) {
               echo '<li>' . $link . '</li>';
            }
            echo '</ul>';
            break;
            default:
            echo '<table width="100%" border="0" cellpadding="0" cellspacing="1">';
            echo '<tr>';
            echo '<td nowrap="nowrap">';
            echo '<span class="'. $menuclass .'"> '. $params->get( 'end_spacer' ) .' </span>';
            echo implode( '<span class="'. $menuclass .'"> '. $params->get( 'spacer' ) .' </span>', $links );
            echo '<span class="'. $menuclass .'"> '. $params->get( 'end_spacer' ) .' </span>';
            echo '</td></tr>';
            echo '</table>';
            break;
         }


to this:

            case 1:
            echo '<ul id="'. $menuclass .'">';
            foreach ($links as $link) {
               echo '<li>' . $link . '</li>';
            }
            echo '</ul>';
            break;
            default:
            echo '<table width="100%" border="0" cellpadding="0" cellspacing="1">';
            echo '<tr>';
            echo '<td nowrap="nowrap">';
            echo '<span class="'. $menuclass .'"> '. $params->get( 'end_spacer' ) .' </span>';
            echo implode( '<span class="'. $menuclass .'"> '. $params->get( 'spacer' ) .' </span>', $links );
            echo '<span class="'. $menuclass .'"> '. $params->get( 'end_spacer' ) .' </span>';
            echo '</td></tr>';
            echo '</table>';
            break;
         }
Title: Re: Top module
Post by: xenios on March 07, 2008, 14:38:46
Does anybody knows if this is bad change???   :P
Title: Re: Top module
Post by: datahell on March 07, 2008, 19:33:52
Where is the difference? Except if you mean that you removed the surrounding code (remove the "switch" and leave the "case"s as is) which generates PHP error.
Title: Re: Top module
Post by: xenios on March 08, 2008, 00:24:24
yes, but i don't have any php error.... i attached the file!!!

[old attachment deleted by admin]
Title: Re: Top module
Post by: datahell on March 08, 2008, 01:18:42
I have no time to check your file. You pasted here 2 blocks of code that seems to me identical. Where is the difference? What are your modifications?
Title: Re: Top module
Post by: xenios on March 08, 2008, 02:37:29
This is the original module code:

      $menuclass = 'mainlevel'.$params->get( 'class_sfx' );
        if (count( $links )) {
         switch ($style) {
            case 1:
            $random = rand(100, 999);
            echo '<ul id="'.$menuclass.$random.'" class="'.$menuclass.'">'._LEND;
            foreach ($links as $link) {
               echo '<li>'.$link.'</li>'._LEND;
            }
            echo '</ul>'._LEND;
            break;
            case 0:
            default:
            $ends = $params->get( 'end_spacer');
            $mids = $params->get( 'spacer' );
            //echo '<div>'._LEND;
            if ($ends != '') { echo '<span class="'.$menuclass.'">'.$ends.'</span>'._LEND; }
            if ($mids != '') {
               echo implode( '<span class="'.$menuclass.'"> '.$mids.' </span>', $links );
            } else {
               foreach($links as $link) { echo $link."\n"; }
            }
            if ($ends != '') { echo '<span class="'.$menuclass.'">'.$ends.'</span>'._LEND; }
            //echo '</div>'._LEND;
            unset($ends);
            unset($mids);
            break;


And this is how i changed:



      $menuclass = 'mainlevel'. $params->get( 'class_sfx' );
      if (count( $links )) {
         switch ($style) {
            case 1:
            echo '<ul id="'. $menuclass .'">';
            foreach ($links as $link) {
               echo '<li>' . $link . '</li>';
            }
            echo '</ul>';
            break;
            default:
            echo '<table width="100%" border="0" cellpadding="0" cellspacing="1">';
            echo '<tr>';
            echo '<td nowrap="nowrap">';
            echo '<span class="'. $menuclass .'"> '. $params->get( 'end_spacer' ) .' </span>';
            echo implode( '<span class="'. $menuclass .'"> '. $params->get( 'spacer' ) .' </span>', $links );
            echo '<span class="'. $menuclass .'"> '. $params->get( 'end_spacer' ) .' </span>';
            echo '</td></tr>';
            echo '</table>';
            break;
         }




IT HAS A BIG DIFERRENCE, I REPLACED THE OLD CODE FROM MODULE 2006.4 TO WORK PROPERLY MY TOP MODULE...
Title: Re: Top module
Post by: datahell on March 08, 2008, 08:57:12
Now you pasted the right code blocks.
If you examine your changes you will see that the 2008.0 code is much better. Elxis 2008 does not uses tables, so you should use CSS to place the html elements. An other important parameter is that you make your html code xhtml invalid as you removed the $random from the ul ID. I prefer 2008.0's html, if you wish to use 2006's, it is your site!
Title: Re: Top module
Post by: xenios on March 08, 2008, 14:15:56
Ok, i agree with your answer, but i tried a lot of changes to my css mainmenu an top menu and nothing happened.  Any suggestion??

Thank for your precious time on replying..
Title: Re: Top module
Post by: Ivan Trebješanin on March 08, 2008, 18:08:10
Hi, I just had to ask you: what are you trying to achive? I couln't see your point in above changes to the code. As you said in your first post, you should use CSS for visual formatting, not PHP. Can you explain or give us example of how you want your menu to look like?
Title: Re: Top module
Post by: xenios on March 08, 2008, 21:14:28
Ivan, thank you for answering.  I am trying to upgrade my old website from 2006.4 to 2008 elxis...

I found this problem that i cannot fix through topmenu module settings or css code..... after a lot of searching i found this solution: To change this part of code in module, this was causing the error..

Look at the images please.  And if you need login and password to take a look please pm me!

[old attachment deleted by admin]
Title: Re: Top module
Post by: datahell on March 08, 2008, 21:42:19
You can easily do this with CSS. No need to hack Elxis source code for this.
Title: Re: Top module[SOLVED]
Post by: Ivan Trebješanin on March 09, 2008, 20:13:22
Here's the point: you cannot use #mainlevel-nav for styling your menu. You have to use ul.mainlevel-nav!!! That's all I did, and it took me 30 sec to login, do the neccecery change in CSS and log out. No need to hack Elxis core. ;)
Title: Re: Top module[SOLVED]
Post by: xenios on March 09, 2008, 20:26:59
Thaaaaanks!!!!!!     ;D   ;D   ;D  Ivan you are a pro!!  I am an amature....

You are great!


It's almost ironic because i tried this change yesterday morning it seems due to cache reasons on my computer i didn't saw any change!!!   ;D

I am very huppy/