Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#331 2021-01-04 00:53:31

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

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

kees-b wrote #327879:

I have rather a large number of sections (60+) and after adding two new ones I got this error when accessing adi_menu: ‘fatal error: allowed memory size of 134217728 bytes exhausted’.

Hmm … a couple of possibilities spring to mind, but then again they don’t really make sense:

  1. adi_menu does use recursion and could be disappearing into a loop … but I’m sure I put some code in to prevent it.
  2. arrays are used for internal storage, but I can’t believe that 128MB is being chewed up for only 60 sections

Do you see the error on the admin or public side? May be worth checking there’re no loops – e.g. child1 belongs to parent1 which belongs to grandparent1, grandparent1 belongs to child1. What’re your TXP/adi_menu versions?

Bruce Bowden wrote #327979:

I just hit the same bug but with many fewer sections. Boosting the PHP memory allocation didn’t fix the error But..

My new sections had numeric names: 2020, 2021, etc. Changing the names to 2020events fixed the problem. I was able to leave the title as 2020 so the change won’t impact the final appearance of the site.

Interesting …! Leave it with me, but could you confirm the TXP & adi_menu versions, thanks.

Offline

#332 2021-01-04 02:16:08

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 28

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

TXP version 4.8.4 and adi_menu version 1.4beta13

Offline

#333 2021-01-05 09:34:55

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

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

Hi kees-b & Bruce Bowden.

Very interesting indeed! Took me a little while to work out what was going on but thanks to the numerical section name clue (thanks Bruce) I was able to nail it … hopefully.

Try this one & let me know how you get on.

Offline

#334 2021-01-05 20:33:45

Bruce Bowden
Member
From: Melbourne, Australia
Registered: 2020-10-22
Posts: 28

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

Hi Adi,
That works for me. No problems anymore with numeric section titles.

Thank you for the quick response.

Stay safe
Bruce

Offline

#335 2021-01-06 05:55:01

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

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

Bruce Bowden wrote #328058:

That works for me. No problems anymore with numeric section titles.

Great … and to draw a line under this long drawn out string of betas here’s the official 1.4 release.

If you’ve been a previous 1.4beta user, visit the adi_menu admin tab immediately after installing 1.4 in order to automatically run an upgrade process.

There’s a raft of updates to the plugin which I’ve listed in the initial post on this thread.

Please note that although it hasn’t been updated fully for TXP 4.7+, it will still be fully functional – albeit with a couple of untranslated language strings in the admin tab. It’s on my to-do list … honest.

Last edited by gomedia (2021-01-08 01:21:37)

Offline

#336 2021-03-18 06:08:56

wavesource
Member
From: Australia
Registered: 2011-08-02
Posts: 56

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

Hi all – I have encountered this as well, a site running latest adi_menu_14 with 60 or so sections and maybe 50 virtual sections. meh.

What I’m seeing is it’s just the size of the POST getting blocked in modsec using vanilla Atomicorp rules 390707, which is blocking anything with more than 1000 vars.

I’ve overridden it myself, but still not able to save the menu at this point, so I am just editing the database table directly. But I guess this could be happening a lot in many environments.

Offline

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

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 228
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,373

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: 228
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: 92
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,373

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: 228
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: 5,238
Website GitHub

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: 228
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: 5,238
Website GitHub

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

Board footer

Powered by FluxBB