Author Topic: Show_menu2 adding strange code  (Read 1775 times)

Offline svsanchez

  • Posts: 569
Show_menu2 adding strange code
« on: April 19, 2021, 07:45:38 PM »

I am having a strange problem with SM2, which I am using for creating a list of pages inside of my categories via a CODE module.

This is what I have in the code module:

show_menu2(SM2_ALLMENU, SM2_CURR+1, SM2_CURR+1, SM2_ALL|SM2_ALLINFO, '<p><strong>[a][menu_title]</a>:</strong> [description]</p>', false, '');

This creates a list of subpages with their descriptions, like:

Which is what I want, HOWEVER, when you see the source of the page, this is what it shows:

<a class="section_anchor" id="wb_5886" name="wb_5886"></a><p><strong><a href="" title="Agroquímicos en Guatemala" target="_top">Agroquimicos</a>:</strong> Encuentre aquí empresas dedicadas a la elaboración, importación y comercialización de agroquímicos en Guatemala. Insecticidas, herbicidas, fungicidas, fertilizantes, etc.</p></li><p><strong><a href="" title="Café en Guatemala" target="_top">Café</a>:</strong> Directorio de empresas cafetaleras en Guatemala. Cultivo, compra, venta y exportación de café guatemalteco. Tosta, mezcla y venta de cafés finos y orgánicos.</p></li>

As you can see, there is a lot of code that I didn't include in the SM2 code, like:
- <a class="section_anchor" id="wb_5886" name="wb_5886"></a>
- the ending </li> tag

That particular ending </li> tag is appearing many times as an error on the w3 html validator, and I would like to know how to get rid of it.

Where can I do this?

Offline dbs

  • Betatester
  • **
  • Posts: 8738
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Show_menu2 adding strange code
« Reply #1 on: April 19, 2021, 08:12:58 PM »
Hi, for code please use the code button # in the toolbar.

Your menu has only 6 parameters of 10. So show_menu fills the rest with the default parameters.
</p> should not be there


Code: [Select]
$aMenu 0,
$aStart SM2_ROOT,
$aMaxLevel SM2_CURR+1,
$aOptions SM2_TRIM,
$aItemOpen '[li][a][menu_title]</a>',
$aItemClose '</li>',
$aMenuOpen '[ul]',
$aMenuClose '</ul>',
$aTopItemOpen false,
$aTopMenuOpen false

in your case it could be

Code: [Select]
(SM2_ALLMENUSM2_CURR+1SM2_CURR+1SM2_ALL|SM2_ALLINFO'<p><strong>[a][menu_title]</a>:</strong> [description]''</p>'false,falsefalsefalse);

Offline svsanchez

  • Posts: 569
Re: Show_menu2 adding strange code
« Reply #2 on: April 19, 2021, 11:58:44 PM »
Amazing! Thank you so much dbs!!!