Extension talk:SectionLinkToTop

Latest comment: 12 years ago by MikeDarling in topic Links disappear after editing page

Undefined Constant error edit

Hey, i get the following error - how can it be fixed?

Notice: Use of undefined constant MAG_SECTIONLINKTOTOP - assumed 'MAG_SECTIONLINKTOTOP' 
in /wiki/extensions/SectionLinkToTop/SectionLinkToTop.php on line 90

''line 90:'' 
$magicWords[MAG_SECTIONLINKTOTOP] = array( 0, '__SECTIONLINKTOTOP__' );

MediaWiki: 1.15.1
PHP: 5.2.12 (cgi-fcgi)
MySQL: 5.0.67-log

— Preceding unsigned comment added by 84.60.185.46 (talkcontribs)

At the moment, I can only confirm your observation, I see the same error message in my log files. Action: I changed to
$magicWords['MAG_SECTIONLINKTOTOP'] = array( 0, '__SECTIONLINKTOTOP__' );

NOEDITSECTION problem edit

Greetings.

Im having sobre problems when using the SectionLinkToTop plus the NOEDITSECTION magic word.

If i define both, the links to the top do not appear. this only happens with H1 headding sections, on all other section levels its shows OK

Im not a big expert on wiki. Can anyone help me?

Palanolho 13:16, 14 March 2011 (UTC)Reply

Found the problem.
in the SectionLinkToTop.php look for the function parserAfterTidy and instead of
$pattern = '#(<h[2-6]>)( <span.*</h[2-6]>)#i';
use
$pattern = '#(<h[1-6]>)( <span.*</h[1-6]>)#i';
(it was rendering only for Heading 2 or more)
Palanolho 13:30, 14 March 2011 (UTC)Reply

Links disappear after editing page edit

It seems like I currently need to re-insert the magic word (__SECTIONLINKTOTOP__) every time a page is edited. I'm using Mediawiki 1.16 with FCKeditor. Is this by design? Is there a way around it?

--MikeDarling 16:02, 12 January 2012 (UTC)Reply

Work when user is not logged in? edit

Is there a way I can make the link appear even when the user does not have editing rights?

Need To Prevent Error On Pages This Magic Word Not Added To edit

  • hey, hi, guys, hope all of you who are using this very slick little extension are doing well.
  • I have come across something. If the sysadmin enables this extension, but the wiki users have not yet added the magic word to a particular page yet, then PHP throws the following error
  • Notice: Use of undefined constant MAG_SECTIONLINKTOTOP - assumed 'MAG_SECTIONLINKTOTOP' in /var/www/html/wiki/extensions/SectionLinkToTop/SectionLinkToTop.php on line 77
  • if the user adds the magic word to the page, the error goes away
  • what we here at our office are thinking is that the extension needs to consider the intentional omission of this magic word on a page and not throw this error
  • pls help with this if you can
  • thx
  • cheers

Need Test on Latest Stable Version edit

Can any one help test this on the latest stable version of Mediawiki, (v.1.20.2) which is now many versions past the one referenced on the extension's main page. Thanks very much.

Any luck with compatibility with latest stable version of mediawiki edit

  • Any luck with compatibility with lates stable version of mediawiki?
  • thanks everyone

Is Anyone Out There edit

  • Is Anyone Out There?
  • Anyone working on this Extension any more? or is it dead?
  • it does not work with the latest stable version of mediawiki
  • what should we all decide to do with it?

Re: Is Anyone Out There edit

Hi,

Replace the text in http://en.wikipedia.org/wiki/Wikipedia:Back_to_top:

addOnloadHook(function() {
	var elems = document.getElementsByClassName('editsection');
	for (i = 0; i < elems.length; i++) {
		var span = document.createElement('span');
		var link = document.createElement('a');
		link.href = '#top';
		link.appendChild(document.createTextNode('back to top'));
		span.appendChild(document.createTextNode('['));
		span.appendChild(link);
		span.appendChild(document.createTextNode('] '));
		elems[i].insertBefore(span, elems[i].firstChild);
	}
});

Change the line

var elems = document.getElementsByClassName('editsection');

to

var elems = document.getElementsByClassName('mw-editsection');

you can add to your user User:Common.js or, if you want to load for everybody, add it to your MediaWiki:Common.js

:-)

Re: Re: Is Anyone Out There edit

This is great, thank you! This works as good as the plugin if not better. However, it seems that this only works for logged in users. Any way to make it appear for users who don't see an edit button?

Potrod (talk)

Return to "SectionLinkToTop" page.