Extension talk:NoTitle
[edit] Doesn't work for 1.10
Doesn't work for 1.10. 66.31.209.239 23:55, 6 June 2007 (UTC)
Confirmed. Someone please fix this or look at it! I'd love to have a working version. Changing the stylesheet is such a crude solution to this problem and it affects all pages instead of selective ones. 216.99.65.63 18:35, 2 August 2007 (UTC)
- Problem solved, it still uses CSS but it works for 1.10 now, just look under Known Problems and use that php instead of the normal script. I've only tested on version 1.10 so far so if someone wants to try it out on a lower MW version plz let me know how it goes! --Diploid
[edit] Error messages (1.10)
Works sometimes on 1.10, but not on all pages.
Errors:
Notice: Undefined variable: action in /var/www/bkwiki/extensions/NoTitle/NoTitle.php on line 38
Notice: Undefined variable: action in /var/www/bkwiki/extensions/NoTitle/NoTitle.php on line 38
Notice: Undefined property: ParserOptions::$mHideTitle in /var/www/bkwiki/extensions/NoTitle/NoTitle.php on line 46
Notice: Undefined variable: action in /var/www/bkwiki/extensions/NoTitle/NoTitle.php on line 38
-- Bjoern, 14. Jul 2007 00:02
- I had this same problem, try my patch at the bottom of the page, it fixed it for me.
- --Diploid 18:50, 14 August 2007 (UTC)
[edit] How to disable caching?
This extension is used on the http://uncyclopedia.info main page, and it seems that once a huge cache (APC) was added to the site, the page title started displaying whenever the user hit reload/refresh in the webbrowser.
I've kludged around this problem by using the random selection algorithm <choose><option> (or any other tag or item that forces a cache disable) on the affected MW1.11 pages, but perhaps this extension itself should be patched to turn off the parser cache on any page on which it is invoked? --Carlb 12:29, 16 July 2007 (UTC)
- There is a better way: craft an extension that looks for a 'magic word' in the hook 'OutputPageBeforeHTML' and triggers code in the hook 'SkinTemplateOutputPageBeforeExec' to blank the title (can't really remove the HTML completely without a code hack); parser cache friendly solution. Jean-Lou Dupont 18:50, 2 August 2007 (UTC)
- Use Extension:PageFunctions if you wish to change the page's title whilst respecting parser caching. Jean-Lou Dupont 19:05, 2 August 2007 (UTC)
- Easy way - just add one line $parser->disableCache(); right after the mHideTitle=true; is set. That fixes this bug. Tested and working on uncyclopedia.info under APC and MW1.11alpha --Carlb 17:43, 5 August 2007 (UTC)
Doesn't work for 1.11. 81.53.23.145 12:49, 2 September 2007 (UTC)
[edit] Bug with 1.11
Doesn't seam to work with the latest mediawiki version... any idea when this will be fixed ? : ) Here is what I get:
MediaWiki internal error.
Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook NoTitle::addMagicWordId failed to return a value; should return true to continue hook processing or false to abort.' in SERVERPATH/mediawiki/includes/Hooks.php:133
XApple 11:59, 25 November 2007 (UTC)
- I've seen this with various extensions and recent MW1.12 releases; usually adding "return true;" at the point where the offending routine ends will make this go away. --Carlb 23:10, 25 January 2008 (UTC)
[edit] I used a snippet of this extension to hide the Main_Page title
- MediaWiki: 1.11.1
- PHP: 5.2.3 (apache2handler)
- MySQL: 5.0.51a
- URL: DishiWiki
From the Article (Extension) page:
"You can remove the "Main Page" title on the front page by including the following in MediaWiki:common.js
In many cases, this bypasses the need for the extension. (Emphasis added by this user.)
/** Main Page layout fix *******************************************************
*
* Description: UNDOCUMENTED
* Maintainers: UNMAINTAINED
* The following code was pulled from Wikipedia's http://en.wikipedia.org/wiki/MediaWiki:Common.js, and is used to
* supress the title on the main page.
*/
var mpTitle = "Main Page";
var isMainPage = (/(title=|\/wiki\/)([Tt]alk:|)[Mm]ain[ _][Pp]age/.test(document.location));
var isMainPageFront = (document.title.substr(0, document.title.lastIndexOf(" - ")) == mpTitle);
var isDiff = (document.location.search && (document.location.search.indexOf("diff=") != -1 || document.location.search.indexOf("oldid=") != -1));
if (isMainPageFront && !isDiff)
{
document.write('<style type="text/css">/*<![CDATA[*/ #lastmod, #siteSub, #contentSub, h1.firstHeading { display: none !important; } /*]]>*/</style>');
addOnloadHook( appendOtherLanguageLink );
}
/**/
Placing only the snippet (above) in my Mediawiki:common.js page indeed hid the title of Main_Page. As stated in the article, I did not have to install the Extension itself. But the code above caused the non-fatal "Javascript error on page" using Internet Explorer 7: "appendOtherLanugageLink" not defined." So I removed the line
addOnloadHook( appendOtherLanguageLink );
which removed the Javascript error. I have not experienced any other problems yet. (For unknown reason(s), I had not been able to hide the title of the Main_Page using any other method.)
- Brian7632416 19:41, 11 May 2008 (UTC)
-
- This fix worked extremely well on MW1.12 as well. Thanks, Brian7632416! --Ishmayl 22:15, 19 May 2008 (EDT)
- Doesn't work for 1.15.2 --Mark 12:21, 1 April 2010 (UTC)
- This fix worked extremely well on MW1.12 as well. Thanks, Brian7632416! --Ishmayl 22:15, 19 May 2008 (EDT)
[edit] 1.14 alpha
Works on the above, except right after installing, something strange happened: Special:Version came up empty. Had to revert, uncommenting require_once. Also can't make it transclude through templates. Any clues? —Sasoriza 06:40, 9 October 2008 (UTC)
Wish List
This is a good extension that deserves a little more work to make it really great. A few suggestions that I have include:
- Don't limit the extension to the only the title
- As long as you can find the names of the CSS classes, it is really easy to expand the extension to include __NOCAT__ (a magic word to hide the category links section at the bottom of the page), __NOTABS__ (a magic word to hide the tabs at the top of the page), or any number of other page elements.
- Try not to tie the extension to any particular skin
- Instead of hard coding CSS class names, consider using variables that pull class names from a separate .i18n file (similar to how messages are switched in extension like Extension:ParserFunctions). That way, others can append the .i18n file to suit alternate or growing needs.
- Take a look at how the code goes through the parser
- I found, like Sasoriza's comment in 1.14 alpha, above, that the extension doesn't work through transclusion. I also found that that <nowiki> tag (<nowiki>__NOTITLE__</nowiki>) does not keep the magic word from functioning. I suspect that each of these has to do with parsing.
Thanks, --PerkinsTaylor 05:00, 11 March 2009 (UTC)
- I wish the __NOTITLE__ works on special pages called by call extension also
[edit] Doesn't Work in 1.15.1 or 1.16alpha
After upgrading our private wiki from 1.12 to MW 1.15.1, the __NOTITLE__ magicword is simply ignored. I created a sandbox copy of my wiki and patched it with 1.16alpha but still got the same result. Yes, before you ask, I have replaced my original NoTitle.php with the updated MW 1.13-corrected code (as found on this Extension page in the "MediaWiki 1.13" section.) Has anyone else had this problem, and does anyone have a fix? I'm plowing my way through .php and .css but I'm not exactly a PHP/CSS expert (I may become one after this is all over!) There's obviously a lot of differences with the Parser from 1.13 onward. Any comments, thoughts, help would be appreciated... I might even regard obscene catcalls in a constructive light at this point. ApostleGreen 22:16, 28 July 2009 (UTC)
Manual:Hooks shows that MagicWordMagicWords has been deprecated. I'll perhaps look into a fix later. andrewdodd13 12:28, 4 August 2009 (BST)
NoTitle 1.13-corrected code works with Mediawiki 1.15.1. --62.47.133.219 15:41, 18 August 2009 (UTC)
It doesn't work with the cavendish-skin. --93.135.75.80 18:11, 3 June 2011 (UTC)
[edit] Modification for gumax skin
If you're using the gumax skin, see http://forum.paulgu.com/viewtopic.php?f=6&t=368&p=1728#p1728 on how to make it work...
[edit] Transclusion of __NOTITLE__ doesn't work
Hi I'm trying to transclude a page with __NOTITLE__ in it into another page, such that the second page doesn't show the title. The page with __NOTITLE__ in it works fine (shows no title), but the page that is trancsluding the original page simply shows "__NOTITLE__" as plain text and doesn't pick it up as a magic word. Any suggestions on how to fix that?
-- RichardJ87
Hi Richard.
I got it to work by adding the extra hook:
$wgHooks['ParserBeforeTidy'][] = array($NoTitle, 'checkForMagicWord');
before:
$wgHooks['ParserAfterStrip'][] = array($NoTitle, 'checkForMagicWord');
-- mitchelln
[edit] Alternate method without having to use the extension below
Add the following code below to your monobook.css (MediaWiki:Monobook.css) Modifying the Nameofpage to match the page you want to not show the title.
/* Removing the Main Page title from the main page. */
body.page-Nameofpage #siteSub,
body.page-Nameofpage #contentSub,
body.page-Nameofpage h1.firstHeading {
display: none !important;
}
- hmm... should work, but it did not work for me. I am using monaco. Bigbull 17:57, 18 September 2011 (UTC)
[edit] A minor bug, a couple of annoyances and a showstopper
EDIT: Nevermind, problems seem to have been fixed using the 1.13 version.
[edit] MW 1.16b
it seem that this doesn't work for the above version.:-( Msevero 07:19, 16 March 2010 (UTC)
-
- Not working for me either. Any chance of getting this fixed?
- Thanks mitchelln 15:19, 24 March 2010 (UTC)
- Not working for me either. Any chance of getting this fixed?
-
-
- I can't get it to work either. I've tried the Common.js fix and no joy there either. Since both Wikipedia (now using 1.16) and MW both have their Main Page title suppressed, there surely has be a relatively straightforward fix for this. I'd very much appreciate advice on it. --Sabretache 08:18, 7 May 2010 (UTC)
-
-
-
-
- MW and Wikipedia suppress it via css:
-
-
body.page-Main_Page h1.firstHeading {
display: none;
}
-
-
-
- However it only works for the main page. Cheers --kgh 09:11, 7 May 2010 (UTC)
-
-
-
-
-
-
- Thanks a bunch for that Kghbln. Works a treat. Simple when you know how eh? --Sabretache 07:48, 8 May 2010 (UTC)
-
-
-
-
-
-
-
-
- Your welcome. However, I would like to see this extension fixed, too. Let's hope for the best. Cheers --kgh 12:35, 8 May 2010 (UTC)
-
-
-
- Hi. I assume that if you do:
-
body.page h1.firstHeading {
display: none;
}
-
- It will suppress it on every page?
- mitchelln 11:39, 23 July 2010 (UTC)
-
-
- No, it does not work. But do not ask me :-( Perhaps the rewritten code provided in the meantime helps the cause. Looks good to me. Cheers --kgh 11:28, 27 July 2010 (UTC)
-
[edit] Mediawiki 1.15.2
When used the Version Special Page doesn't show any information. --Mark 12:10, 1 April 2010 (UTC)
[edit] Rewrite
- Works with MW 1.16
- Doesn't disable the parser cache
- Doesn't search for the magic word itself, since the parser already does that
- hides the subhead (redirected from notice etc.)
- works better with the other included skins (it doesn't hide the title on modern, because that would look weird)
<?php $wgExtensionCredits['parserfunction'][] = array( 'name' => 'No title', 'author' => '[http://www.mediawiki.org/wiki/User:Nx Nx]', 'description' => 'Adds a magic word to hide the title heading.' ); $wgHooks['LanguageGetMagic'][] = 'NoTitle::addMagicWordLanguage'; $wgHooks['ParserBeforeTidy'][] = 'NoTitle::checkForMagicWord'; class NoTitle { static function addMagicWordLanguage(&$magicWords, $langCode) { switch($langCode) { default: $magicWords['notitle'] = array(0, '__NOTITLE__'); } MagicWord::$mDoubleUnderscoreIDs[] = 'notitle'; return true; } static function checkForMagicWord(&$parser, &$text) { if ( isset( $parser->mDoubleUnderscores['notitle'] ) ) { $parser->mOutput->addHeadItem('<style type="text/css">/*<![CDATA[*/ .firstHeading, .subtitle, #siteSub, #contentSub, .pagetitle { display:none; } /*]]>*/</style>'); } return true; } }
Nx 21:05, 24 May 2010 (UTC)
- Have a wiki on 1.16.0. This rewrite flat out does not work.
--98.236.74.122 14:16, 6 December 2010 (UTC)
- The rewrite works for me on a wiki on 1.16.0, though it doesn't show up in list of active extensions at Special:Version. Mike Linksvayer 02:10, 7 December 2010 (UTC)
- Added 1.16 section to article page to make this easier to find. Seems the extension ought to be versioned and that version ought to be one working with 1.16. I'm not sure what version the code at the top of the article really works with. Mike Linksvayer 02:15, 7 December 2010 (UTC)
[edit] How to make it work in 1.17
I have copied the rewrite made for 1.16 into the notitle.php file and placed it in extensions folder. Other than that using it in Vector skin with __NOTITLE__ does not hide the title of the page.
Any help would be appreciated.
[edit] Is there a working version for 1.18 ?
Thanks in advance :-)
- Yea, I tested one version, edited the page and it works. Try it. --Choshi 21:12, 11 December 2011 (UTC)
[edit] Will this be maintained in the future?
The new versions, this will come?