Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#349 2022-08-08 22:51:06

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

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

Thanks demoncleaner & jakob.

Apologies for the delayed reply. Looks like you’ve fixed it without me! The relative_urls attribute is what I would’ve done anyway, so I’ll make a note for next time.

Offline

#350 2023-02-08 10:27:44

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

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

Hi, I had to switch my install (4.8.8) to php 8.0 and now I ran into an error whenever opening (login!) the write-tab:

Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result, bool given in /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_db.php:874 
Stack trace: 
#0 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_db.php(874): mysqli_num_rows() 
#1 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/plugins/adi_menu/adi_menu.php(1643): safe_field() 
#2 [internal function]: adi_menu_article_section_popup() 
#3 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/plugins/adi_menu/adi_menu.php(1613): preg_replace_callback() 
#4 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_misc.php(1589): adi_menu_article_tab() 
#5 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_admin.php(841): callback_event() 
#6 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/include/txp_article.php(1910): pluggable_ui() 
#7 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_admin.php(386): article_partial_section() 
#8 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/include/txp_article.php(769): updatePartials() 
#9 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/include/txp_article.php(119): article_edit() 
#10 /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/index.php(230): include('...') 
#11 {main} 
thrown in /mnt/web501/e0/46/54511946/htdocs/rosenheim-evangelisch.de/textpattern/lib/txplib_db.php on line 874

Last edited by saccade (2023-02-08 10:31:05)

Offline

#351 2023-02-08 17:04:40

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

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

I can confirm that, but I only get it with a new “Write” tab. If it’s an existing article, it works fine.

This is a quick fix until Adi shows us a better way. Find function adi_menu_article_section_popup() in the plugin and make the following two minor modifications:

if ($step == 'edit') { // editing existing ($step = GET var) or creating new article ($step = POST var)
	if (!empty($GLOBALS['ID'])) // newly-saved article, get section from POST vars
		$select_section = gps('Section');
	else { // existing article, get ID from GET vars & section from database
		$article_id = gps('ID');
		if (is_int($article_id)) $select_section = safe_field("section", "textpattern", "id=".$article_id);
	}
}
// else // empty article
if (!isset($select_section))
	$select_section = getDefaultSection(); // default section for articles (defined in Sections tab)
$out = '… … …

The modifications are:

  • Add if (is_int($article_id)) in front of $select_section = … to prevent Textpattern trying to find the section for a non-existent / non_integer current article id (i.e. in the case of a new empty Write tab).
  • Comment out the else statement for an empty article
  • Beneath it (or in its place), add the line if (!isset($select_section)) as the fallback for when no $select_section has been defined until that point. The following line starting $select_section can remain indented.

TXP Builders – finely-crafted code, design and txp

Offline

#352 2023-02-09 12:58:42

saccade
Plugin Author
From: Neubeuern, Germany
Registered: 2004-11-05
Posts: 521

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

Great! Jakob, thank you very much! Works fine!

Offline

#353 2024-02-05 08:06:09

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 177
Website

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

I’ve been using adi_menu for a long while for one of my websites, https://tramping.net.nz/, where I use two menu levels. (The website has 14 top-level sections with about 80 sub-sections, most of them children in two different groups.)

Recently, I finally upgraded to Txp 4.8.8.

It’s all working now on my public website, but it looks like I’ve been locked out of any further changes, like adding additional sections.

I can’t access the Menu listing in the Presentation tab on my adi_menu admin panel as usual.

All I get, when I click on the Menu option under Presentation for the plugin admin, is a blank page, with an orange warning note on the bottom line stating: Upgrade required.

So, the story is that Adi worked out my particular circumstances where I had a virtual section that was based on a category! Yeah, I was confused as well.

He called this adi_menu version 1.5beta. I guess no one else has it. (And I do feel special!)

I’ve three choices.

  • Option 1. Revert to Txp 4.7.1, which I was using. That would work, but it is not preferable for clear reasons. I’d do Option 2 before this.
  • Option 2. Delete the whole semi-superfluous sub-section and revert to adi_menu version 1.4. It isn’t as necessary as I first thought, and I wouldn’t really miss it. It would be better if it stuck around. And this reversion may cause additional issues.
  • Option 3. Get adi_menu version 1.5beta working somehow. The best option, obviously.

I can access the plugin code and see that Adi made some notes for adi_menu version 1.5beta.

Version history:
	1.5		- TXP 4.7+ only
			- attributes removed: 'test', 'new_article_mode', 'sep'
			- new: pageless sections ignored (4.8+)
			- new: link names shown in redirect link select list
			- new: attributes 'parent_link_class', 'sub_menu_class' & 'sub_menu_link_class' 
			- improvements: admin tab paging & style enhancements
			- changed: new sections default to excluded
			- removed: prefs for tailoring section list in write tab
			- fixed: title_no_widow error in articles mode in 4.8
			- fixed: table settings tweaks
	1.4		- new feature: virtual sections
			- etc

So, when delving into the coding, once the database coding has been added, the next lines are:

if (@txpinterface == 'admin') {

	// it's a modern-ish world
	if (!version_compare(txp_version, '4.7.0', '>=')) return;

	adi_menu_init();
}

I’ve changed the ’4.7.0’ to both ’4.8.8’ and ’4.8.0’ but the same error message occurs. Strangely, the menu admin panel flashes for a fraction of a second before turning to whitespace.

The website seems unaffected by those changes.

The other thing is the Textpack is from his old web address, which has been deleted. However, I only use English, and I’m not sure that is needed.

function adi_menu_init() {
// general admin setup
	global $prefs, $event, $adi_menu_url, $adi_menu_prefs, $adi_menu_debug, $adi_menu_db_debug, $adi_menu_plugin_status;

	$adi_menu_installed = adi_menu_installed();

	// Textpack
	$adi_menu_url = array(
		'textpack' => 'http://www.greatoceanmedia.com.au/files/adi_textpack.txt',
		'textpack_download' => 'http://www.greatoceanmedia.com.au/textpack/download',
		'textpack_feedback' => 'http://www.greatoceanmedia.com.au/textpack/?plugin=adi_menu',
	);
	if (strpos($prefs['plugin_cache_dir'], 'adi') !== FALSE) // use Adi's local version
		$adi_menu_url['textpack'] = $prefs['plugin_cache_dir'].'/adi_textpack.txt';

	// get hold of language strings hidden behind event wall
	if (in_array($event, array('adi_menu_admin', 'plugin_prefs.adi_menu', 'adi_menu_options')))
		adi_menu_load_lang('install_textpack, exclude, section_name');

	// plugin lifecycle
	register_callback('adi_menu_lifecycle', 'plugin_lifecycle.adi_menu');

etc

So, now that Adi seems to have found a new life in another country, what is the recommendation?

Any help is appreciated, but maybe the first thing is working out how to get the admin panel visible.

Cheers from sunny New Zealand.

Edit: added website.

Last edited by detail (2024-02-05 08:08:28)

Offline

#354 2024-02-05 09:00:54

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

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

He called this adi_menu version 1.5beta. I guess no one else has it. (And I do feel special!)

Sorry to say it but I also have the 1.5beta ;-)
Not sure if it is the same 1.5beta than you have. Maybe it could help you finding it out. Because I have not experienced any of those difficulties that you are describing and I have a bunch of websites running on 4.8.8.

but wait… now that I think about it I might have. Have you tried to completely uninstall adi_menu and reinstall the beta? Can you make a backup of your current state in case all the menu order will get lost during that attempt?

Last edited by demoncleaner (2024-02-05 09:04:06)

Offline

#355 2024-02-05 09:17:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

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

Also, what version of PHP are you both using? Some of the more recent versions are more finicky.

Does flicking your site temporarily to debugging mode and refreshing the adi_menu panel reveal anything useful?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#356 2024-02-05 10:29:12

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

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

You might also want to look at the dev branch of my adi_menu GitHub repo. The dev branch has “my v1.5” modifications from earlier in the thread (e.g. bugfixes and demoncleaner’s relative path URLs) and adi’s own 1.5 beta parts as well. On top of that, it’s also been switched to the Textpattern textpack language string system rather than those on adi’s site, and I dropped some of the checks for legacy PHP and Textpattern versions. the exercise is intended as a trial run for saving some of adi’s other plugins.

I’m not sure it will solve your blank panel problem, but that may have other reasons.

Note: This has been in development, so there’s no compiled installer as yet. To install this plugin, either:

  • download and extract the GitHub repo into a folder called “adi_menu” and then zip up the folder and install the zip file via the plugin installer file upload button, or…
  • replace the contents of your /textpattern/plugins/adi_menu/ folder with the contents of the plugin and then reload the plugin from disk.

(It’s probably a good idea to make a db and plugin folder backup first)


TXP Builders – finely-crafted code, design and txp

Offline

#357 2024-02-07 04:52:46

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 177
Website

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

Thanks, everyone, for all your prompt replies.

Sorry, but time zones, New Zealand’s national holiday, and work have intervened.

Plus, I had to get my head around what might be the issue.

I think I know what I need to do.

I’ve gone through my history on this thread, and it seems I first used the plug-in in 2015. Adi and Oleg helped out with the category issue I had back then.

That worked splendidly until I had an issue I picked up back in 2019 about a jump in the sort values, which went from 40 something directly to the max 255, and that was resolved with a version Adi concocted called adi_menu 1.4beta13.

I did not upgrade to adi_menu 1.4.1, which I assume incorporated that sort issue fix.

adi_menu 1.4beta13 worked well until the change from Txp 4.7.1 until I installed Txp 4.8.8 as discussed, a month or so ago.

My current PHP remains at 7.4.33, as it has since at least 2019. That does not seem to be the issue.

jakob wrote #336570:

To install this plugin, either:

  • download and extract the GitHub repo into a folder called “adi_menu” and then zip up the folder and install the zip file via the plugin installer file upload button, or…
  • replace the contents of your /textpattern/plugins/adi_menu/ folder with the contents of the plugin and then reload the plugin from disk.

For some reason, my Mac was unable to create a gzip for adi_menu 1.5 in Terminal, and I had a glitch in uploading adi_menu 1.5 from GitHub, and I didn’t manage to do it using the first method.

So went with the second. I have replaced all the files in the /plugins file on my server with the adi_menu 1.5 version, but these haven’t yet been activated.

It’s showing I’m the Author in the Admin menu plugins list, and it’s at version 1.

The import from disk option is jammed and doesn’t allow a choice of a new file.

The website seems to still be operating normally, although I still have no Menu option in the Presentation dropdown..

I guess whatever was in the database has not been overwritten.

Hopefully, I’ve just about fallen over the line.

Any thoughts on activating the upgrade?

Cheers

Offline

#358 2024-02-07 10:23:07

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

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

detail wrote #336573:

For some reason, my Mac was unable to create a gzip for adi_menu 1.5 in Terminal, and I had a glitch in uploading adi_menu 1.5 from GitHub, and I didn’t manage to do it using the first method.

I’ve just tried both methods, albeit on a blank install.

Not sure about gzip, but if you create a regular zip file on the Mac (with right-click and compress), it will include the resource fork (a parallel folder tree that starts with __MACOSX that Mac user’s don’t see but windows/linux do), so you need to clean the zip file afterwards. Some programs like Keka have an option to zip and “exclude Mac resource forks”, or you can clean it after the event. I have an automator function for this, which you can save as a tiny app onto which I can simply drop zip files to clean them, or make a finder action out of it:

TLDR: zip the adi_menu folder as a normal zip file without the resource fork on the Mac (or clean it afterwards) and then you can install that zip via the “Upload plugin” file chooser on Admin › Plugins.

So went with the second. I have replaced all the files in the /plugins file on my server with the adi_menu 1.5 version, but these haven’t yet been activated. It’s showing I’m the Author in the Admin menu plugins list, and it’s at version 1. The import from disk option is jammed and doesn’t allow a choice of a new file.

First up, if you want to keep the old version for a way back, make a copy of the textpattern/plugins/adi_menu/ folder outside of your plugins folder.

  • Replace the contents of adi_menu with the files from the dev branch on my GitHub repo.
  • On the Admin › Plugins panel, click on the checkmark in front of adi_menu, then in the dropdown at the bottom of the table, choose “with 1 selected: Update from disk”. That should reload the entire plugin, including manifest file and textpack showing the correct plugin author details.

TXP Builders – finely-crafted code, design and txp

Offline

#359 2024-02-07 19:09:16

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 177
Website

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

Thanks, Jakob.

I’ll give these a go later today and let you know.

Fortunately, the nav stuff is still working on the website.

Offline

#360 2024-02-08 09:12:18

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 177
Website

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

Some good news.

I deleted the earlier version of Adi_menu and uploaded the development branch zip file without that extra Mac stuff.

The main Admin Plugin’s page now lists it with Adi’s name, Version 1.5.0. It looks like the development version. The Help files read correctly.

I seem to recall that my version had an Options panel to the right of the Help, but from memory, that was to install Textpack. That is no longer visible, but I guess it is no longer required.

I did the load from disk thing.

I checked the server, and it looks right; all the files have appeared.

That’s all good.

Unfortunately, something’s not right.

The Menu is in the dropdown Presentation menu, but it has the same issue.

It flashes on the page for a millisecond, and the orange “Upgrade required” error message still appears.

The website is working properly in public, and otherwise, I’m adding pages, images, etc.

I’m just unable to add sub-sections and shuffle around the menu order, as it could have happened at the end of last year.

This is currently not a major problem, as I managed to tear my Achilles tendon late last year, and I won’t be doing any more trips for the next six months. A great summer, and I’m missing out!

Still, it is giving me time to work on this 1500-page website and attend to these issues. Long overdue.

I’m thinking I should try to install the 1.4.2 version and see if that works.

It seems that somehow adi_menu is still essentially working off the original version he did for me in 2019, if that is at all possible. The 1.5.0 hasn’t overwritten tables in the database or something.

10 pm now, and tomorrow is another day.

Offline

Board footer

Powered by FluxBB