WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: spida on April 03, 2008, 10:26:28 AM

Title: show_menu2 without target attribute
Post by: spida on April 03, 2008, 10:26:28 AM
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 (http://www.rot65.de/dokuwiki/doku.php/cms/WebsiteBaker/debug#attribut_target_entfernen)

Regards,
Ayshe
Title: Re: show_menu2 without target attribute
Post by: brofield on April 10, 2008, 05:12:07 AM
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)
Title: Re: show_menu2 without target attribute
Post by: spida on November 28, 2008, 03:21:43 PM
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
Title: Re: show_menu2 without target attribute
Post by: Stefek on November 28, 2008, 03:35:28 PM
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
Code: [Select]
<?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

Title: Re: show_menu2 without target attribute
Post by: spida on December 02, 2008, 11:41:27 PM
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:
Code: [Select]
<?php show_menu2(&#39;<li><a class="[class]" url="[url]">[menu_title]</a></li>&#39;); ?>
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
Title: Re: show_menu2 without target attribute
Post by: BerndJM on December 03, 2008, 12:17:27 AM
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:
Code: [Select]
<?php show_menu2(0SM2_ROOTSM2_ALLSM2_TRIM|SM2_PRETTY, &#39;<li><a class="[class]" href="[url]">[menu_title]</a>&#39;); ?>
Also the </li> is not necessary in $aitemOpen, because it's the default value for $aItemClose.

Regards Bernd
Title: Re: show_menu2 without target attribute
Post by: spida on June 10, 2009, 06:57:23 PM
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
Code: [Select]
show_menu2(0,39,SM2_ALL, SM2_ALL, SM2_TRIM|SM2_PRETTY);Still, the target attribute is shown.  

I also tried this:
Code: [Select]
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:
Code: [Select]
show_menu2(0,39,1,true,'[li]<a href="[url]">[menu_title]</a>');
Cheers,
spida