Jump to content

Extension talk:ForceTocOnEveryPage

About this board

How to make exceptions in hooks

3
Cozbaldwin (talkcontribs)

I don't know if anyone will ever see this, but I'd love to know how to exempt specific pages... and NOTOC doesnt work.

I am smart enough to know I would do it in hooks.php but not smart enough to know how to write the code I need... because every attempt I made throws an error and breaks the site.

I just want to make exceptions based on either title of page or the page ID.

Current HOOKS portion of exemptions looks like this:

 if($parser->getTitle()->getNamespace()!=0)
   {return true;}
 if($parser->getTitle()->equals(Title::newMainPage()))
   {return true;}
Cozbaldwin (talkcontribs)

Furthermore... ideally, I'd prefer it as exempting the Page Title and also an array of Page Titles. Thank you!

Cozbaldwin (talkcontribs)

Actually... if anyone ever sees this... after further consideration, it would probably be easiest to just allow NOTOC to override the extension. But any solutions would be grateful. Thanks.

Reply to "How to make exceptions in hooks"

Not working with mediawiki ver 1.31.5

1
Summary by Libattery

You should

wfLoadExtension("ForceTocOnEveryPage");

Libattery (talkcontribs)

With ForceTocOnEveryPage and mw 1.31.5, I got only white screen and no error messages.

When commentout ForceTocOnEveryPage I got normal screen.

So I guess ForceTocOnEveryPage have problem with mw 1.31.5.

There are no older topics