Extension talk:Title Icon

About this board

Trouble getting TitleIcon to work

8
Legaulph (talkcontribs)

I add the code

{{#set:Title Icon=UnderConstruction.png}}
{{#set:Title Icon=Article.png}}
{{#set:Title Icon=Inproceedings.png}}

Nothing.

Cindy.cicalese (talkcontribs)

Did you create a Property named Title Icon and set its type to Text? See this link. This is the most common cause of the problem. I'm assuming that you also uploaded the files in question (UnderConstruction.png, Article.png, and Inproceedings.png) so that they are available to the extension.

91.224.226.197 (talkcontribs)

This is a very important note. I made the same mistake. Perhaps this should be mentioned in the Relase notes.

Cindy.cicalese (talkcontribs)

It was already mentioned in the documentation, but I repeated and bolded it.

Legaulph (talkcontribs)

Well thank you Cindy works perfectly now

Knazanga (talkcontribs)

I have the same issue. I don't understand what Cindy means by setting Title Icon property's type to Text. In my Property:Title Icon page I have the property values printed in red color (It seems the files don't exist) although the files exist. My Mediawiki version is 1.27 and TitleIcon is the 3.0.

Cindy.cicalese (talkcontribs)

If they are red links, that means the property type is Page, not Text. You have not created the property page or have not set the property type on that page. Navigate to the page "Property:Title Icon" (unless you have used $wgTitleIcon_TitleIconPropertyName to change the name of the property to something different) and save that page containing the wiki text [[Has type::Text]].

194.25.185.146 (talkcontribs)

Doesn't work here, too.

Created the page 'Property:Title Icon' with the only content [[Has type::Text]]. (shows red 'Has type::Text' when saved)

Also tried without Space and set $wgTitleIcon_TitleIconPropertyName = 'Property:TitleIcon'; with no success.

At another page I inserted {{#set:Title Icon=myexstingicon.svg}} and this text is shown as text on the page instead of generating an icon.

I'm on Mediawiki 1.35 and the Extension shows up installed at the version page of the wiki.

Reply to "Trouble getting TitleIcon to work"

{{#hidetitleicon: Doesn't seem to work.

1
Medicinestorm (talkcontribs)

I have a page "P" with an icon specified via {{#titleicon_file:P-image.png}}, and it belongs to category "C", which also has a different icon specified via {{#titleicon_file:C-image.png}}. On page P, both C-image.png and P-image.png show in the title, so I added {{#hidetitleicon:category}} to P.

But both C-image.png and P-image.png continue to appear in the title of P. What am I missing?

Reply to "{{#hidetitleicon: Doesn't seem to work."

Use of this extension without SMW

2
Jonathan3 (talkcontribs)

I use Cargo rather than SMW. I was going to ask whether you are planning to change this extension to work with Cargo also. Then I saw your comment below: "I'm considering changing the extension to use page properties (built into MediaWiki core) rather than Semantic MediaWiki to store the title icon information." Have you had an opportunity to make progress on this? Thanks.

Cindy.cicalese (talkcontribs)

I have not had a chance to work on it, but it is still my intention to do so.

Reply to "Use of this extension without SMW"
Summary by Kghbln

Tracked with task T207284

Krabina (talkcontribs)

Hi, in MW 1.31.1, PHP 7.1.22 and TitelIcon 4, I get the follwing error:

... Error from line 289 of .../extensions/TitleIcon/TitleIcon.php: Undefined class constant 'TYPE_STRING'
Backtrace:
#0 ../extensions/TitleIcon/TitleIcon.php(224): TitleIcon->getPropertyValues(Title, string)
#1 ../extensions/TitleIcon/TitleIcon.php(161): TitleIcon->getIcons()
#2 ../extensions/TitleIcon/TitleIcon.php(138): TitleIcon->getIconHTML()
#3 ../extensions/TitleIcon/TitleIcon.php(74): TitleIcon->handlePageTitle(OutputPage)
#4 ../includes/Hooks.php(177): TitleIcon::showIconInPageTitle(OutputPage, SkinChameleon)
#5 ../includes/Hooks.php(237): Hooks::callHook(string, array, array, NULL, string)
#6 ../includes/OutputPage.php(2385): Hooks::runWithoutAbort(string, array)
#7 ../includes/MediaWiki.php(868): OutputPage->output(boolean)
#8 ../includes/MediaWiki.php(880): MediaWiki->{closure}()
#9 ../includes/MediaWiki.php(524): MediaWiki->main()
#10 ../index.php(42): MediaWiki->run()
#11 {main}
Cindy.cicalese (talkcontribs)
Kghbln (talkcontribs)

This reminds me that I should probably install this extension on <sandbox.semantic-mediawiki.org> to allow for earlier detection of such issues. For now it will be nice if an task is created at Phabricator to help track this issue.

Cindy.cicalese (talkcontribs)

Yes, a Phab task would be great. I've got a backlog of extension tasks/patches to address, but I hope to free up some time in the next few weeks.

Krabina (talkcontribs)
Krabina (talkcontribs)

Hi Cindy, another feature I am missing is to be able to define a link target for the icon. As I heavily use page forms and other extensions that use the category pages for configuration, I usually try not to use the category pages too much for the user's purposes. Instead I add custom pages with dynamic content (ask queries of SMW).

So I'd like to be able to have the title icon for "People" defined in Category:People, but link to a page called "People".

Could be done with something like

{{#set:Title Icon Link=People}} 

and the property Title Icon Link being of type page

Cindy.cicalese (talkcontribs)

Good idea.

Also, I'm considering changing the extension to use page properties (built into MediaWiki core) rather than Semantic MediaWiki to store the title icon information, so Title Icon would not require installation of another extension. Thoughts?

Krabina (talkcontribs)

Always a good idea to minimize dependencies. But also always appreciated to support SMW if its available (like in CommentsStreams)...

Cindy.cicalese (talkcontribs)

Yes, I could always fall back to SMW if it is available.

Reply to "Define Icon link"
Krabina (talkcontribs)

Would be a great feature if

{{#set:Title Icon=File.png}} 

worked in Namespace pages, e. g. defined in Project:File or {{#set:Title Icon=Event.png}} in a custom namespace, you could set it in Project:Event

Cindy.cicalese (talkcontribs)

Are you saying that, if a custom namespace named Event is created, that putting

{{#set:Title Icon:Event.png}}

on page Project:Event would display the title icon on all pages created in namespace Event? Is Project:<namespace name> a pre-defined page for custom (or other) namespaces?

Krabina (talkcontribs)
Cindy.cicalese (talkcontribs)

OK, I was just talking to @Yaron Koren about how he implements this in Page Forms. This does seem like a reasonable thing to do, if you don't want to use categories. Out of curiosity, is there a reason you would prefer to use namespaces over categories for this?

Krabina (talkcontribs)

Because this way you can simply add a nice title icon to the File:Namespace. Uploaded files usually don't get put into a separat category...

Cindy.cicalese (talkcontribs)

Excellent example. I will add this to my to do list.

Reply to "Namespaces?"
Krabina (talkcontribs)

Hi,

Fatal error: Class 'HtmlArmor' not found in .../extensions/TitleIcon/TitleIcon.php on line 163

When I set $wgTitleIcon_EnableIconInSearchTitle = false; the rest of the extension works fine, just the search is broken when I set it to true. I am using MW 1.27.3 and Title Icon 4.0 (5ed8bf7). In 3.0 it works. cheers, Bernhard

Cindy.cicalese (talkcontribs)

Ah, the release notes didn't get updated. Yes, you will need to use version 3.0. Version 4.0 was updated to work with MediaWiki 1.28 and greater, which requires use of the HtmlArmor class. I will try to update the release notes on the extension page as soon as possible. Thanks for bringing this to my attention.

Kghbln (talkcontribs)

Done as a service. :)

Cindy.cicalese (talkcontribs)

Thank you, Karsten!!!

Reply to "Error on search"
RDGGDR (talkcontribs)

I've had Title Icon/Viki Title Icon working before. I've just installed a fresh wiki (1.26, as 1.27 seems to have problems with SMW). I've got the 1.26 version of Title Icons installed, with the Title Icon property set as a Text property and the following in LocalSettings.php:

require_once "$IP/extensions/TitleIcon/TitleIcon.php";

$TitleIcon_TitleIconPropertyName = "Title Icon";

I'm getting the following error when I set a Title Icon (and the icon doesn't display):

Uncaught ReferenceError: jQuery is not defined(anonymous function) @ index.php?title=Test_System:168

This resolves to:

<script>/*<![CDATA[*/jQuery( document ).ready( function() {

jQuery( '#firstHeading' ).each( function( index ) {

var title = jQuery( this ).html();

jQuery( this ).html( '<a href="/wiki/index.php?title=Test_System" title="Imagetitle"><img alt="Imagealt" src="/wiki/images/thumb/6/6c/Image.png/36px-Image.png" width="36" height="36" srcset="/wiki/images/thumb/6/6c/Image.png/54px-Image.png 1.5x, /wiki/images/thumb/6/6c/Image.png/72px-Image.png 2x" /></a>&nbsp;' + title );

} );

} );/*]]>*/</script>

Cindy.cicalese (talkcontribs)

That error is fixed in the most recent commit on the master branch and the REL1_27 branch. You can use the REL1_27 version with 1.26.

Reply to "jQuery error"
Shuryard (talkcontribs)

Hello! With the Title Icon installed, when I try to open my wiki (any article), it gives me a blank page. Any thoughts? Thanks!

Kghbln (talkcontribs)

See this page on how to get more information on the cause of the error. Also you should state the version of MediaWiki, Title Icon and PHP you are using to allow narrowing down the issue. Note that this extension requires Semantic MediaWiki to be installed first. This one is up and running too?

Shuryard (talkcontribs)

Thank you for your reply. SMW is installed. I have MW 1.26.2 and PHP 5.3.24 (apache2filter). TitleIcon is for MW 1.26. This is my debug message (I deleted my path details in front of /w):

Fatal error: Uncaught exception 'Exception' with message
'/.../w/extensions/TitleIcon/extension.json does not exist!' in /.../w/includes/registration/ExtensionRegistry.php:106 Stack trace:
#0 /.../w/includes/GlobalFunctions.php(181): ExtensionRegistry->queue('/.../')
#1 /.../w/LocalSettings.php(163): wfLoadExtension('TitleIcon')
#2 /.../w/includes/WebStart.php(123): require_once('/.../')
#3 /.../w/index.php(38): require('/.../')
#4 {main} thrown in /.../w/includes/registration/ExtensionRegistry.php on line 106
Kghbln (talkcontribs)

Ah, that's it, at least I guess. The extension's docu applies to MW 1.27+. On REL1_26 you should still invoke with

require_once "$IP/extensions/TitleIcon/TitleIcon.php";

Title Icon in ask query results

3
Legaulph (talkcontribs)

Should I see the title icon in the ask query results?

Cindy.cicalese (talkcontribs)

You should see the filename of the title icon, but not the image itself.

Legaulph (talkcontribs)

Thanks

Reply to "Title Icon in ask query results"
Return to "Title Icon" page.