show_menu2 without target attribute

spida

#7
Hi,

although this a really old thread I am still busy (or rather busy again) with the unwante target attribute.
Right now I am using WB 2.7 and the following code for a menu
show_menu2(0,39,SM2_ALL, SM2_ALL, SM2_TRIM|SM2_PRETTY);
Still, the target attribute is shown.  

I also tried this:
show_menu2(0,39,SM2_ALL, SM2_ALL, SM2_TRIM|SM2_PRETTY, '<li><a href="[url]">[menu_title]</a></li>');
with the same disappointing result.
As much as I appreciate the menu2 mod, this target stuff really sucks.

Best would be anyway to remove the target setting in the backend at the page settings. There is no need for my customers ever to set a target on a menu item. I had expected WB 2.7 to have gotten rid of that thing, but no, it didn't.

Anyway, if anyone still can think of another way to explain this to me, I would be very pleased.

EDIT

I got it now. This is the code that works for me:
show_menu2(0,39,1,true,'[li]<a href="[url]">[menu_title]</a>');

Cheers,
spida

BerndJM

#6
Sorry spida,

you're joking with this call you postet above?
You really give the string for $aItemOpen as the first and only parameter  :? that will never work in the expected way.
You have to give the SM2 function acomplete parameter list!
Up to $aFlags all the parameters are mandatory.

What happens with a call like yours?
SM2 sees the first parameter is not a number and set it to a default value (0), than it sees there are no other parameters following and sets all to it's default values ... and ... the "target is back again.

Try this:
<?php show_menu2(0SM2_ROOTSM2_ALLSM2_TRIM|SM2_PRETTY'<li><a class="[class]" href="[url]">[menu_title]</a>'); ?>

Also the </li> is not necessary in $aitemOpen, because it's the default value for $aItemClose.

Regards Bernd
In theory, there is no difference between theory and practice. But, in practice, there is.

spida

Hi Stefek,

I have studied the readme several times and tried various code combinations, nothing works. Either my navigation is completely destroyed or it still has the target attribute.

I also tried:
<?php show_menu2('<li><a class="[class]" url="[url]">[menu_title]</a></li>'); ?>

Result: target is still rendered as attribute (with empty value).

Somehow I seem to have overseen something relevant. Can you help me a little further please?

Cheers,
spida

Stefek

Hello Spida,
there is really no need to prepare the showMenu-2 Module Files in order to get rid of the target attribute.

If you use the standard call
<?php show_menu2(); ?>
then yes.

Also if you use something like this  [a] or [ac] in your sm2-call.

But you can also use:
'<a class="[class]" url="[url]" target="[url]">[menu_title]<a>'

Please study the show_menu2 Read-Me Files.

Here in German:
http://addons.websitebaker.org/media/download_gallery/show_menu2-4.5_README-de.txt

Regards,
Stefek

[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

spida

Hi brofield,

I tried your line of code, but it doesn't work for me.

If I have SM2_TRIM in it, the target attribute is removed, but also my style definitions for the list and anchor elements are ignored, thus the navigation is displayed incorrect.

If I leave out SM2_TRIM, style sheets are applied correctly but the target attribute is there again.

Do you have any idea what might be the cause? How else can I get rid of the target attribute?

Best regards,
spida

brofield

#2
To do this without modifying the code, you just specify the format string.
See the documentation.
http://code.jellycan.com/files/show_menu2-README.txt

e.g. equivalent to show_menu2() but with a different format string.
show_menu2(0, SM2_ROOT, SM_CURR+1, SM2_TRIM, '[ li]<a href="[url]">');

(note: remove extra space between [ and li] to use this string)

spida

Hi,

if anyone ever wondered - like me - how to get rid of the target attribute which is automatically generated by show_menu2: Here's a brief (german) description of my solution
http://www.rot65.de/dokuwiki/doku.php/cms/WebsiteBaker/debug#attribut_target_entfernen

Regards,
Ayshe