Extension talk:Icon
Missing argument 2 for eficon_languagegetmagic
editI get the error Warning: Missing argument 2 for eficon_languagegetmagic() in /home/imsaw/public_html/mediawiki/extensions/Icon/Icon.php on line 38
- What verson of MediaWiki are you running? That's a call from the 'LanguageGetMagic' hook. Tim Laqua talk 01:00, 16 January 2008 (UTC)
Paragraph around the image
editThe extension is wonderful, but I ran into trouble. It generates a new paragraph around the image. That works fine in most cases, in this case though, it ruins the table I use it in. How can that be fixed? Also is there a way to make it more flexible (closer to the Image: functionality) where you can omit image alt text and width and only add the link? Maybe add a class to it as well to make it more easy to customize it for end users.
- You can stop the paragraph tags by wrapping it in a div - the P tags come from the parser trying to render valid XHTML:
<div>{{#icon:Coolpic.png}}</div>
You can omit alt text and width by simply leaving them empty:{{#icon:Coolpig.png|||Special:Help}}
Tim Laqua talk 03:41, 27 January 2008 (UTC)
- Thanks a ton! Any chance you can add the div into the extension itself so it would do that on it's own? --Simon Moon 18:12, 27 January 2008 (UTC)
- Addition: if I omit the width, it says "Bad Width" in the resulting preview page. --Simon Moon 03:41, 28 January 2008 (UTC)
- What version of the Extension are you using? 1.1? And I can't add the DIV in as when the page is parsed, the #icon parser function is replaced by a unique marker like: UNIQ-XXXXXXXXXXX-QINU and then the HTML output of the function is put back in later - this is to prevent corruption of the output. But then we have the problem of plain text - plain text can't exist in the body tag, it MUST be encapsulated - which is why the parser puts those P tags in there. wrapping the parser function in a DIV tag makes it legal XHTML. ;-) Tim Laqua talk 12:55, 28 January 2008 (UTC)
- The Bad Width message should only appear if you provide a width, but it is invalid. Like if you put a space in there or a character value. The following should be valid in version 1.1:
{{#icon:Coolpig.jpg|||Special:Help}}
Let me know if that's not working. Tim Laqua talk 13:00, 28 January 2008 (UTC)
to external link support
editIt would be really nice to be able to link external pages too (http://, https:// )
- Implemented in r30400. Don't post new versions, post patches off the current SVN revison. The version you posted broke existing implementations by wrapping the output in a DIV. The links now have the 'iconlink' class and the image tags now have the 'iconimg' class. External links have the 'plainlinks' class to suppress the CSS3 external link icon. Also - sign your comments. Tim Laqua talk 18:15, 1 February 2008 (UTC)
Inside an unordered list
editI'm trying to use {{#icon}}
inside an unordered list. Wikitext looks like this:
* test item <div>{{#icon: TopPick.gif | Guide Favorite }}</div> * other item
HTML output looks like this:
<ul> <li>test item<div> </li></ul> <img class='iconimg' style="vertical-align: middle;" src='/images/TopPick.gif' /></div> <ul><li>other item</li></ul>
Is there any way I can get the <img>
inside the <li>
? Is it the parser trying to generate valid XHTML again? Jlerner 21:21, 11 February 2008 (UTC)
- Yeah, it has to do with the order that the parser handles things. There 's a line break thrown in there at some point (hence, the DIV wrapper) - but since the MW style UL blocks are based on consecutive lines - it being wrapped in a DIV doesn't help there (because the block level processor finds a line that doesn't start with a * and closes out the list). The only way to do it (afaik - i'm not a MW parser guru) is with an HTML list (in which case you don't need the DIV wrapper as it's wrapped by the LI tags:
<ul> <li>test item {{#icon: TopPick.gif | Guide Favorite }}</li> <li>other item</li> </ul>
Usually fine f/ admins, but asking normal users to use HTML is not desirable Tim Laqua talk 01:40, 12 February 2008 (UTC)
- Looks like changing the last line of
function efIcon_Render()
to the following fixes the problem!
- Looks like changing the last line of
return $parser->insertStripItem($output, $parser->mStripState);
- Credit goes to User:Jimbojw and his extension EmbedVideo 0.1.2. Jlerner 06:00, 12 February 2008 (UTC)
- Interesting. I'll update the extension later today. Thanks for investigating! Tim Laqua talk 13:35, 12 February 2008 (UTC)
- Credit goes to User:Jimbojw and his extension EmbedVideo 0.1.2. Jlerner 06:00, 12 February 2008 (UTC)
What links here
editDunno if it's a bug or known, but pages calling an image using this extensions don't show up on the "What links here" section of the description page. --Subfader 14:43, 3 April 2008 (UTC)
- Correct. That's because this extension was specifically created to suppress links to the Image description page. The "What links here" op on an Image's description page is not a list of where the image is used. It's a list of pages that link to the Image's description page. Tim Laqua talk 02:31, 4 April 2008 (UTC)
- How could it be fixed? I have a similar extension written by someone else but atm I have the same problem. It works at least on Special:Whatlinkshere --Subfader 10:33, 6 April 2008 (UTC)
- I can't think of a good way to do it without literally linking to the Images description page. You could check with the other extension's author and see if he is interested in implementing (I assume you're referring to ImageLink). Tim Laqua talk 13:24, 6 April 2008 (UTC)
- How could it be fixed? I have a similar extension written by someone else but atm I have the same problem. It works at least on Special:Whatlinkshere --Subfader 10:33, 6 April 2008 (UTC)
- Thanks, I got around it using a template which includes <span style="display:none">[[File:{{{1}}}]]</span> and the {{#Extension|Foo}}. This way the file link is called but hidden. --Subfader 15:15, 6 April 2008 (UTC)
- Clever. ;-) Tim Laqua talk 15:29, 6 April 2008 (UTC)
- Implemented in r34776, v1.5. You shouldn't need the magic template anymore. ;-) Tim Laqua talk 01:57, 14 May 2008 (UTC)
- Clever. ;-) Tim Laqua talk 15:29, 6 April 2008 (UTC)
- Hehe cool. I tried and first I thought it doesn't work with {{#icon:Foo.jpg}} but I quickly found out you shouldn't use underscores in the filename. it has to be the exact file name from the desc page (which never has underscores), so you cannot copy the destination filename on the uploading process. So if desc page is File:File Name.jpg
- {{#icon:File Name.jpg}} works / is used / linked
- {{#icon:File_Name.jpg}} works (displays as intended) / but is not "used" (listed on Special:Unusedimages) and not listed on "what links here"...
- I guess a fix is easy? --Subfader 11:26, 15 May 2008 (UTC)
- Wierd. I'll take a look. I used Title::getDBKey() to get the name of the image page - sounded safe to me. ;-) Tim Laqua talk 21:56, 15 May 2008 (UTC)
- I just tested and I can't reproduce. For me, it works with or without underscores. Can you test again? Tim Laqua talk 22:07, 15 May 2008 (UTC)
- Yeah sorry, you're right. Dunno what confused me, guess should have tested with new uploaded files. --Subfader 09:33, 16 May 2008 (UTC)
- I just tested and I can't reproduce. For me, it works with or without underscores. Can you test again? Tim Laqua talk 22:07, 15 May 2008 (UTC)
- Wierd. I'll take a look. I used Title::getDBKey() to get the name of the image page - sounded safe to me. ;-) Tim Laqua talk 21:56, 15 May 2008 (UTC)
Tooltip Alt Text in Firefox
editHi, nice simple extension. Is it just me, or does the Alt text not display in Firefox as a hover over tool tip? Works fine in IE7 though... thanks 118.92.66.200 23:15, 23 May 2008 (UTC)
- Yes, I have this problem as well. But it only happens when using a width in the link. I saw in the source that this is because the extension ask mediawiki to create the <img> tag, which does not use the title attribute. Is there a clean way to solve this? - Tom 80.201.204.185 23:04, 3 October 2008 (UTC)
HTML Code
editHi! Thi extension produces this (final) html markup in our wiki: <a iconlink href="/OurTestPage"><img alt="TestIcon" src="/images/0/0f/TestIcon.png" border="0" height="14" width="32"></a>
. kinda weird, the link-class and the title-attribute are gone. but anyway, it works... 79.193.235.69 17:18, 29 May 2008 (UTC)
I think there is a little bug at line #106:
$aClass='iconlink';
Should be:
$aClass='class=iconlink';
with this correction I'm able to correctly use the class selector in css and add, for example, a border to the icon
Linked page
editCould you add that pages which are linked thru the icon also show the linking page in their "links to this page"-page? 79.193.235.69 18:12, 29 May 2008 (UTC)
Localisation of extension
editI am working on the localisation of the messages for this extension on translatewiki.net. Could you tell me what the an 'icon link' is in the message Icon-desc? Is it a link that appears as an icon? Or is it a link to an icon? Or anything else? If you have the time to write a description of each of the messages on the message/qqq pages at translatewiki.net then that would be appreciated - they have more chance of being right than my guesses at a description. Lloffiwr 23:16, 10 January 2009 (UTC)
Works Great
editJust wanted to add that it works like a charm on 1.10 Although I'm using it in templates with icons/photos as links to other pages, and not actually in articles. Or I was placing an icon with no link at all. I was using another very round about method for the linking. And I couldn't find a way to prevent any linking. So I was very happy to find this easily installed lightweight extension. 07:14, 1 March 2009 (UTC)
Link function in MW 1.14
editIn MW 1.14 you now can link external URLs and link to nowhere using [[:File]]. ASFAIK you can't link to articles etc. Images --Subfader 21:55, 20 March 2009 (UTC)
Error
editI use MW 1.15 and after I made all the necessary steps in the instructions, internal error occurred: Backtrace:
#0 C:\wamp\www\wikina\includes\MagicWord.php(244): Language->getMagic(Object(MagicWord)) #1 C:\wamp\www\wikina\includes\MagicWord.php(197): MagicWord->load('icon') #2 C:\wamp\www\wikina\includes\parser\Parser.php(4034): MagicWord::get('icon') #3 C:\wamp\www\wikina\extensions\Icon\Icon.php(28): Parser->setFunctionHook('icon', 'efIcon_Render') #4 [internal function]: efIcon_Setup(Object(Parser)) #5 C:\wamp\www\wikina\includes\Hooks.php(117): call_user_func_array('efIcon_Setup', Array) #6 C:\wamp\www\wikina\includes\parser\Parser.php(178): wfRunHooks('ParserFirstCall...', Array) #7 C:\wamp\www\wikina\includes\parser\Parser.php(190): Parser->firstCallInit() #8 C:\wamp\www\wikina\includes\parser\Parser.php(3704): Parser->clearState() #9 C:\wamp\www\wikina\includes\Article.php(3093): Parser->preSaveTransform('[[category:Orca...', Object(Title), Object(User), Object(ParserOptions)) #10 C:\wamp\www\wikina\includes\EditPage.php(1788): Article->preSaveTransform('[[category:Orca...') #11 C:\wamp\www\wikina\includes\EditPage.php(1157): EditPage->getPreviewText() #12 C:\wamp\www\wikina\includes\EditPage.php(469): EditPage->showEditForm() #13 C:\wamp\www\wikina\includes\EditPage.php(340): EditPage->edit() #14 C:\wamp\www\wikina\includes\Wiki.php(510): EditPage->submit() #15 C:\wamp\www\wikina\includes\Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(CategoryTreeCategoryPage), Object(Title), Object(User), Object(WebRequest)) #16 C:\wamp\www\wikina\index.php(116): MediaWiki->initialize(Object(Title), Object(CategoryTreeCategoryPage), Object(OutputPage), Object(User), Object(WebRequest)) #17 {main}
Could someone help me? --Jafan 13:47, 19 November 2009 (UTC)
- Don't know if you're still trying to install this or not, but I noticed that the directions don't specify to install the "magic" file, but it should be needed. Did you download and install that one as well? --Duke33 20:21, 9 December 2009 (UTC)
- Interesting...I upgraded to 1.61, and i'm getting these same errors. --Duke33 23:07, 9 December 2009 (UTC)
Product Version MediaWiki 1.15.1 PHP 5.2.11 (apache2handler) MySQL 5.0.85-community
Error when icon doesn't exist
editI wanted to test it but when picture for icon doesn't exist it generates error. is it a normal behavior? The error is this: Fatal error: Call to a member function exists() on a non-object in /home/you/public_html/wiki/extensions/icon/Icon.php on line 61
- Since it blows up the entire page (meaning that a plain white page with only the error is returned), I would vote that seems like a bug. --Duke33 18:26, 14 December 2009 (UTC)
If I were you, add a default icon when it does not exists. returning php error is too bad.
- I also noticed that when I tried to run the maintenance script refreshLinks.php, that it puked on this error. So, yes, i think it's a legitimate defect that needs to be fixed. --Duke33 18:45, 16 December 2009 (UTC)
Needed?
editIt looks like in recent versions of MW, a lot of new parameters have been added to the Image syntax, which makes me wonder...are there any features in this extension that aren't supported by MW out of the box? Is this extension necessary any longer? --Duke33 04:50, 10 February 2010 (UTC)
Testing
editHow does this look?