Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#337 2021-07-05 08:57:12

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 205
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Just wanted to report a bug in the 1.4 version.

In the register_callback instead of:

register_callback('adi_menu_article_tab', 'article_ui', 'section');

it should say:

register_callback('adi_menu_article_tab', 'article_ui', 'section','section');

If not the section selectbox is missing its ID. Which causes for example bot_wtc plugin not working properly in conbination with adi_menu.

Offline

#338 2021-07-05 09:14:05

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,372
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

demoncleaner wrote #330872:

Just wanted to report a bug in the 1.4 version.

Thank you. Very timely, as adi_menu is the next cab off the rank for me to update for the modern TXP world.

Offline

#339 2021-07-05 09:22:44

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 205
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

You are welcome. I am glad I could help. Great plugin by the way. I never do a site without it and it helps a lot in my multi-language set up websites.

Just one thing – maybe you are going to change that in a future version anyway or it maybe has been discussed already:

In the past I have tweaked adi_menu to work well with some of the most popular templates out there. Quite often they do have extra classes that are not supported by adi_menu at the moment.
Such as parent_link and parent_ul_class. It would be super nice if adi_menu would support more of those. So bascially a class for every list and every link that could appear (at least 2 levels). That would save so much time in setting it up. With more classes of course it is getting more confusing though. But to rebuild those menus without adjustment of css you would need those classes.

Offline

#340 2022-03-23 12:16:52

gilibaus
Member
From: Italy
Registered: 2013-08-14
Posts: 91
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

In post #1 I read plugin version 1.4 is TXP 4.5+ only, but on Ocean Media website the download link says 4.6+. Which is true?

Offline

#341 2022-03-23 22:12:30

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,372
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Hi gilibaus. The forum & plugin notes are correct – 4.5 and above. I’ll fix my website accordingly. Thanks.

Offline

#342 2022-08-04 04:43:04

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 205
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Somehow I have the feeling that this was addressed before but I cannot find anything about it:
Is there a way to not have absolute paths in the generated menu?

Instead of

https://www.mydomain.com/somesection/

I would love to have

/somesection/

in the href.
Where could I tweak this in the plugins code? Or is it maybe worth considering this to be changed in the original?

Last edited by demoncleaner (2022-08-04 04:43:14)

Offline

#343 2022-08-04 19:32:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,412
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

demoncleaner wrote #333751:

Instead of https://www.mydomain.com/somesection/ I would love to have /somesection/

I like that url scheme variant too.

Where could I tweak this in the plugins code? Or is it maybe worth considering this to be changed in the original?

Search the plugin code for the instances of pagelinkurl(…) in the adi_menu_section_list(…) function. There are about five of them to cover all the different possible redirect situations (i.e. to other sections / categories, and again for virtual sections). That’s an in-built function of txp that builds the url according to whatever url scheme is set in the admin settings, so it makes sense that Adi has used it because it saves him having to cover all those extra different output formats.

What you could do is add an additional attribute of your own and then, if you supply it, strip off $hu (the protocol and domain) from whatever url is generated by Textpattern (essentially reversing this bit of pagelinkurl). That’s probably easier than covering each of the five situations separately.


TXP Builders – finely-crafted code, design and txp

Offline

#344 2022-08-05 12:13:58

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 205
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Thanks a lot jakob. It helped me. I played around with a little bit. I did not end up adding an additional attribute of my own and choose to do a very dirty version for now. Because I did not really understand on how to do this. Also the $hu variable seems to not be available in the plugin, so I could not just strip it off.

My version works fine now.

But I was re-investigating about the use of absolute paths here. Because I was not sure anymore why this could be bad actually and why I wanted this. Turns out it might be not as bad as I thought. Or even not bad at all. Am I wrong? Is it good to use absolute paths in a menu? Sorry for beeing a bit off topic now.

Offline

#345 2022-08-05 13:31:48

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,412
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

demoncleaner wrote #333753:

Thanks a lot jakob. It helped me. I played around with a little bit. I did not end up adding an additional attribute of my own … because I did not really understand on how to do this. Also the $hu variable seems to not be available in the plugin, so I could not just strip it off.

Yes, I realised that too and edited my post a little later with a link to show you where $hu comes from. Txp has a constant called hu which is effectively the site url, and that link shows you how it is obtained (in short: it uses the hu constant unless it’s been override in a pref). Using that means it’ll use whatever was just used by the pagelinkurl() function to generate the url.

I’d need to look at how to add an additional attribute myself, but once it’s included, you should just be able to preg_replace $hu with '' (or '/' if the leading slash is removed with hu) from the url after all the url generating options in adi_menu have happened, i.e. let adi_menu do its work and afterwards, if your attribute is set, remove the domain part that was used when generating the link. Perhaps I’ll have a go if I find a moment.

But I was re-investigating the use of absolute paths here. Because I was not sure anymore why this could be bad actually and why I wanted this. Turns out it might be not as bad as I thought. Or even not bad at all. Am I wrong? Is it good to use absolute paths in a menu?

That article is pretty good and says more or less what I would have written. I personally prefer relative urls for internal links as it makes the site more portable from local to live server (as mentioned in that article). Absolute urls are necessary for canonical urls, sitemaps etc.

Otherwise, if you use Textpattern’s built in txp:permlink (or link="1" attributes for other tags), then you don’t have a choice: you’ll always get absolute urls. From updating other sites, I have seen that some other Textpattern developers leave the site url entry in Admin › Prefs completely empty to get around that portability problem.


TXP Builders – finely-crafted code, design and txp

Offline

#346 2022-08-06 05:55:37

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 205
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Thanks again. Interesting. Never thought about leaving this field just blank to have this effect on permlinks. I am not so much concerned about portability. So I might even stay with the absolute links at the end – at least in the menu – because I see more pros than cons.

I think the main reason why I got confused about that is because the shopping system I work with uses relative links.

Offline

#347 2022-08-06 09:00:15

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,412
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

I added a boolean attribute relative_urls to the adi_menu tag, which suppresses output of the domain and http(s) protocol for domain-internal links. Custom link destinations should work as normal. Use it like this:

<txp:adi_menu relative_urls />

You can find it on GitHub – for the moment, this is the content of the /textpattern/plugins/adi_menu/ folder, not a full-blown plugin installer, so just swap these files out after installing the regular plugin from Adi’s homepage. See the commit for the changes made.

@Adi: if you are not happy with me posting this on GitHub, let me know and I’ll remove it.


TXP Builders – finely-crafted code, design and txp

Offline

#348 2022-08-06 09:58:21

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 205
Website

Re: adi_menu – section hierarchy, section menu and breadcrumb trail

Wow cool. Thank you so much. I will definately give it a try.

Offline

Board footer

Powered by FluxBB