IncludeSection-Talk

Summary: Talk page for IncludeSection.
Maintainer: Petko
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

PHP 7.4 deprecates curly-brace-based subscript syntax, and PHP 8 removes it entirely, which breaks this recipe. The fix is just to replace curly braces with square brackets, thus:

function IncludeSection($m) {
	extract($GLOBALS["MarkupToHTML"]);
	$args = ParseArgs($m[1]);
	$anc = array_shift($args['']);
	if ($anc > '' && $anc[0] != "#")
		return '';
	foreach ($args[''] as $v) {
		$x = IncludeText($pagename, "$v$anc");
		if ($x > '')
			return PRR($x);
	}
}

Said Achmiz

Thanks for reminding me -- updated. --Petko


Can you change the ":ei ?" FidelioEspoir 6/5/16

Done, thanks. --Petko May 06, 2016, at 03:42 AM Thanks !


Thanx for this recipe.
But don't forget to add the (:includesection:) markup to the $SaveAttrPatterns.
Otherwise the included pages/sections might add their links to the targets of the page where you inserted the (:includesection:) markup. That's probaly not what you want.
To avoid that place the following additional line in local/config.php

SDV($SaveAttrPatterns['/\\(:includesection\\s+(\\S.*?):\\)/i'], ' ');

Tontyna February 28, 2009, at 10:05 AM

Thanks, added. --Petko February 28, 2009, at 01:58 PM

Talk page for the IncludeSection recipe (users).