Jump to content

Extension talk:TagAsCategory

Add topic
From mediawiki.org
Latest comment: 10 years ago by 68.62.16.148 in topic Does not work with 1.17.0

Does not work with 1.17.0

[edit]

hookEvent is not defined

[edit]

Hi. Get a "hookEvent is not defined" in the error console. It was ok with 1.16. Looks like it's called to early, before wikibits to be loaded, but have no idea how to fix that. --180.183.188.157 06:25, 6 September 2011 (UTC)Reply


Hi. I'm with the same problem ("hookEvent is not defined"). Have you been solved this case? Thanks.

I also encountered this issue of the box not displaying. Apparently hookEvent has been deprecated since version 1.17. I added my solution on the extension page. Hope this helps! 68.62.16.148 00:20, 4 August 2014 (UTC)Reply

Input box + button don't show up

[edit]

TagAsCategory doesn't even show an Error Message in my Wiki (1.17.0). Installation of the extension is only visible in Special:Version. Doesn't show up on any pages. --82.135.105.34 11:03, 18 October 2011 (UTC)Reply

At first, I thought it might be because the div id is called 'mw-normal-catlinks' in vector skin (see comment at #Note for people running a custom skin). However, even when I change the div id 'catlinks' to 'mw-normal-catlinks' in tagascategory.php it does not show up (unaltered html source code). Any other idea? --82.135.105.34 09:49, 21 October 2011 (UTC)Reply

Problem

[edit]

The links created by the extension are wrong in my wiki. Instead linking to "http://wiki.example.com/index.php?title=Special:Categories"
it links to "http://wiki.example.com/Special%3ACategories" with "%3A" instead of ":" and without "index.php?title=" this does not work.

Similar Problem on Wiki V1.14

[edit]

I get the following error page when I try to add a tag. --Mark Weiser 10:27, 13 May 2009 (UTC)Reply

The action specified by the URL is invalid. You might have mistyped the URL, or followed an incorrect link. This might also indicate a bug in the software used by MTSGWiki.

Will take a look

[edit]

Thanks for the heads-up - I'll take a look. I believe our blog is running in the mode that rewrites URLs. There's probably a way to build a link programmatically through the API that will be compatible with both URL syntaxes. --Gbarnett 22:06, 7 August 2007 (UTC)Reply

Same Problem on Wiki v1.15.1

[edit]

I echo the issue of the original problem. I still use "index.php?title=" which breaks the extension. In other words, clicking on 'Tags' returns the URL "http://wiki.example.com/Special%3ACategories" with "%3A" instead of ":" and without "index.php?title=" this does not work. --SomaticJourney 08:44, 6 February 2010 (UTC)Reply

Anyone? --SomaticJourney 15:57, 13 February 2010 (UTC)Reply

File called ArticleTagger.php??

[edit]

Should the file actually be called ArticleTagger.php? If the require functionis looking for extensions/TagAsCategory/TagAsCategory.php, shouldn't you then have to cretae a directory in extensions called TagAsCategory and then in that directory, name your file TagAsCategory.php?

Yes, should be called TagAsCategory.php

[edit]

Sorry, the extension used to be called "ArticleTagger", but we renamed it to "TagAsCategory" because we felt it was more descriptive.

I've replaced the references to "ArticleTagger" in the extension page with "TagAsCategory" -- sorry about the typo.

--Gbarnett 13:23, 10 August 2007 (UTC)Reply

A function I would like to see.

[edit]

A very nice feature would be to have a drop-down list of all your categories appearing, or an AJAX auto complete feature showing existing categories as you type.

Deleteing tags

[edit]

How do you delete a wrongly named Tag ?

I just edit the article and manually remove the [[category:xxx]] tag from the article. This extension simply makes it easy to inject the category tags into articles... removing them is still through the normal means. --Brianadkins 21:53, 13 September 2007 (UTC)Reply

Thanks I am New to this. see also Project talk:Categories

Note for people running a custom skin

[edit]

You need the "catlinks" div to exist in your skin.

essentially

//name of div identifying categories the page belongs to
if (document.getElementById('catlinks'))
{
    document.getElementById('divLocationForTagForm').appendChild(document.getElementById('tagform'));
}

You can just rename the div if you've ignored / heavily modified monobook.

Neilkt 01:53, 16 September 2007 (UTC)Reply

example sites?

[edit]

Anyone have any example sites running this extension? I would like to see it in action.

--Smarbin 07:09, 19 September 2007 (UTC)Reply

Yes: Esopedia This is one --Claudio Carli 01:37, 22 January 2009 (UTC)Reply

Localized message for "Add tag"

[edit]

For those who haven't figured it out, you can localize the "Add tag" button in the TagAsCategory.php file.

Example with danish text:

 # add localized messages for the "Add Tag" and "(none)" interface strings
    $wgMessageCache->addMessages(
        array (
            'addtag' => 'Tilføj kategori',
            'notags' => '(none)'

-- Kirjapan 10:33, 17 October 2007 (UTC)Reply

How to prevent it appearing on defined pages?

[edit]

Hello, I've tried this excellent script and think it is very helpful for the user to easy add 'tags' to the page. However, I would really like to be able to prevent this add-tag form from appearing on certain defined pages, ie: Main_Page | Foos_Feet etc. It would also be very handy to be able to prevent the add-tag from appearing on all the pages in a certain NameSpace, as well as preventing it from appearing on Category pages. Would this be possible? Another feature that would be great is for non-registered readers to not even see the add-tag form at all. Sadly my coding skills are zeroish so I can't hack it ZooHoo 01:25, 7 December 2007 (UTC)Reply

I have zero coding skills, but would like to exclude the tag as category for at least the main page... anyone? --Mark Weiser 02:11, 4 July 2008 (UTC)Reply
I have changed it to be called by tag <tagascategory> placed at the and of page, so you can add it only to the pages that need it. Here it is:
<?php
/**
 * TagAsCategory
 *
 * A folksonomy extension for MediaWiki
 *
 * Copyright (c) 2007, Molecular
 * BSD License
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 * 	* Redistributions of source code must retain the above copyright notice, this list of
 * 	  conditions and the following disclaimer.
 *
 * 	* Redistributions in binary form must reproduce the above copyright notice, this list
 * 	  of conditions and the following disclaimer in the documentation and/or other materials
 * 	  provided with the distribution.
 *
 * 	* Neither the name of Molecular the names of its contributors may be used
 * 	  to endorse or promote products derived from this software without specific prior
 * 	  written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * @version 1
 * @copyright 2007 Molecular
 * @author Glenn Barnett
 * @author Paul Irish
 * @link http://www.molecular.com/ Molecular
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 *
 *
 * To activate this functionality, place this file in your extensions/ 
 * subdirectory, and add the following line to LocalSettings.php:
 *     require_once("$IP/extensions/TagAsCategory/TagAsCategory.php");
 *
 * We also recommend changing the "Categories" label to "Tags".  This can be 
 * done by going to the "Special:Allmessages" page, and changing the
 * value of "pagecategories" from "{{PLURAL:$1|Category|Categories}}" to 
 * "{{PLURAL:$1|Tags|Tags}}" .
 */
 
if(! defined( 'MEDIAWIKI' ) ) {
   echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
   die( -1 );
}
 
    $wgExtensionCredits['other'][] = array(
        'name' => 'TagAsCategory',
        'author' =>'Molecular', 
        'url' => 'http://www.molecular.com',
        'description' => 'This Extension provides "folksonomy"-type tagging to articles, using Categories as the underlying functionality'
    );
 
    $wgExtensionFunctions[] = 'wfArticleShowTagForm';
    $wgHooks['UnknownAction'][] = 'tagAction';

function wfArticleShowTagForm() {
    global $wgParser;
    $wgParser->setHook( "tagascategory", "articleShowTagForm" );
}
 
function articleShowTagForm($input, $argv, &$parser)
{
 
    global $wgOut;
    global $wgScript;   
    global $wgMessageCache;
    global $wgArticle;

    $article = $wgArticle;
 
    # add localized messages for the "Add Tag" and "(none)" interface strings
    $wgMessageCache->addMessages(
        array (
            'addtag' => 'Add Tag',
            'notags' => '(none)'
        )
    ); 
 
    # load the localized messages into string variables
    $sAddTag = wfMsg('addtag');
    $sNoTags = wfMsg('notags');
    $sTags = wfMsg('pagecategories');               # defined by default as "{{PLURAL:$1|Category|Categories}}"
    $sCategoriesLink = wfMsg('pagecategorieslink'); # defined by default as "Special:Categories"
 
    # determine the URL for the form action
    $actionUrl = htmlspecialchars( $wgScript );        
 
    # generate the form HTML 
    $tagFormHTML=<<<ENDFORM
        <!-- TagAsCategory extension START -->
        <form action="{$actionUrl}" method="get" id="tagform" style="display: none;">
            <input type="hidden" name="title" value="{$article->mTitle->getPrefixedDBkey()}">
            <input type="hidden" name="action" value="tag">
            <input type="text" name="tag" value="" size="15" />    
            <input type="submit" value="{$sAddTag}" />
        </form>
        <script type="text/javascript">
 
        function moveTaggerBox(){
 
            if (document.getElementById('catlinks')){
                // if the Article is already in one or more categories, 
                // 'catlinks' will exist
                document.getElementById('catlinks').appendChild(document.getElementById('tagform'));
            }
            else 
            {
                // if 'catlinks' doesn't exist (the article is in 0 categories)
                // we must recreate the HTML 
                var div1=document.createElement('div');
                div1.setAttribute('id','catlinks');
                var p1=document.createElement('p');
                div1.appendChild(p1);
                var a1=document.createElement('a');
                a1.setAttribute('href',escape('{$sCategoriesLink}'));
                a1.setAttribute('title','{$sCategoriesLink}');
                p1.appendChild(a1);
                var txt1=document.createTextNode('{$sTags}');
                a1.appendChild(txt1);
                var txt2=document.createTextNode(': {$sNoTags}');
                p1.appendChild(txt2);
 
                document.getElementById('bodyContent').appendChild(div1);
                div1.appendChild(document.getElementById('tagform'));
            }
 
            document.getElementById('tagform').style.display = ''; // we defined it as hidden. show it once it's placed correctly
        }
 
        hookEvent("load", moveTaggerBox); // hookEvent() defined in wikibits.js
 
        </script>
 
        <!-- TagAsCategory extension END -->
ENDFORM;
 
    $wgOut->addHTML($tagFormHTML);
}    
 
    function tagAction($action, $article) {
 
        global $wgUser; 
        global $wgRequest;
        global $wgOut; 
	global $wgTitle;
 
        if($action == 'tag' && $wgUser->isAllowed('edit'))
        {
            # set wgUser??
	    $content = $article->getContent();
	    $content = str_replace("\n<tagascategory>", '', $content);
            $newCategoryString = "[[Category:" . $wgRequest->getVal('tag') . "]]";
 
            // if $content doesn't already contain the new Category string...
            if (strstr($content, $newCategoryString) === false) {
 
                // edit the content, appending the new Category string
                // (with newlines) at the bottom of the article.
                //
                // additionally, flag the edit as an 'update', and suppress
                // its inclusion in Recent Changes
 
                $article->doEdit(
                    $content . "\n" . $newCategoryString . "\n<tagascategory>\n",
                    "Added tag: '" . $wgRequest->getVal('tag') . "'",
                    EDIT_UPDATE | EDIT_SUPPRESS_RC
                );
		$wgOut->redirect($wgTitle->getFullURL());

            }
 
            // view the article, and abort further processing by mediawiki (false)
            $article->view();
            return false;
        }
        else
        {
            // we don't have edit rights -- abort the operation, restoring
            // control to the default mediawiki behavior (true)
            return true;
        }
    }

Parhom 12:40, 4 August 2009 (UTC)Reply

Refresh Issue & Possible Fix

[edit]

Hi,

Greate extension. However, I came across an issue. Whenever I used the Add Tag feature, the tag wouldn't show up until I refreshed the browser, changed articles or edited the article. HOWEVER, when I edited the article, I found that the Tag had been added every time I hit refresh.

I.e.

I hit Add Tag, then refresh so I can see it. Refresh once more, again and finally once more. I then hit EDIT. The tag now appears four times in the page text (it still only displays once when you view the article).

I fixed this by making a few tweaks to the last section of TagAsCategory.php, as detailed below.

-- AerosAtar

    function tagAction($action, $article) {
 
        global $wgUser; 
        global $wgRequest; 

        if($action == 'tag' && $wgUser->isAllowed('edit'))
        {
            # set wgUser??
            $content = $article->getContent();
 
            $newCategoryString = "[[Category:" . $wgRequest->getVal('tag') . "]]";
 
            // if $content doesn't already contain the new Category string...
            if (strstr($content, $newCategoryString) === false) { 
/* I found that strpos doesn't correctly identify the string as existing and therefore this check always fails,   */
/* strstr does correctly identify the string as existing or not.  I also made it an Identical comparison operator */
/* in order to ensure it only picked up exactly what was typed into the input box.                                */

                // edit the content, appending the new Category string
                // (with newlines) at the bottom of the article.
                //
                // additionally, flag the edit as an 'update', and suppress
                // its inclusion in Recent Changes
 
                $article->doEdit(
                    $content . "\n" . $newCategoryString . "\n",
                    "Added tag: '" . $wgRequest->getVal('tag') . "'",
                    EDIT_UPDATE | EDIT_SUPPRESS_RC
                );

                // Refresh the page to display the new category
                header("Location:http://localhost/index.php/".$article->mTitle);
            }
/* I added this so the page would refresh in order to make sure the new tag could be seen as having been added. */
/* I couldn't get it to work with $IP, however, so I had to hard-code the opening Location section.             */

            // view the article, and abort further processing by mediawiki (false)
            $article->view();
            return false;
        }
        else
        {
            // we don't have edit rights -- abort the operation, restoring
            // control to the default mediawiki behavior (true)
            return true;
        }
    }
}

Actually, it looks like the issue with strpos not correctly identifying the category string is a really silly bug in the code.

            $newCategoryString = "[[Category:" . $wgRequest->getVal('tag') . "]]";
 
            // if $content doesn't already contain the new Category string...
            if (strpos($content, '$newCategoryString') == false) {

should actually be:

            $newCategoryString = "[[Category:" . $wgRequest->getVal('tag') . "]]";
 
            // if $content doesn't already contain the new Category string...
            if (strpos($content, $newCategoryString) == false) {

The ' surrounding $newCategoryString are causing it to try to find the string "$newCategoryString" in $content, rather than the value of $newCategoryString. -- 65.209.146.242 16:11, 19 August 2010 (UTC)Reply

I actually came across a slight issue with the code change I made above, in that the header path should not be explicit (if you're not using localhost, it doesn't work). A slightly more elegant solution is to do the following:
                header($wgArticlePath.$article->mTitle);

--AerosAtar

Code Modification: Multiple tags at once

[edit]

I love this extensions, but wanted to ability to add multiple tags at one time. So I updated the code to do this. I changed the form used to add tags (to make it larger) and modified the tagAction function to allow multiple tags. Here's the updated code:

<?php
/**
 * TagAsCategory
 *
 * A folksonomy extension for MediaWiki
 *
 * Copyright (c) 2007, Molecular
 * BSD License
 *
 * Redistribution and use in source and binary forms, with or without modification, are
 * permitted provided that the following conditions are met:
 *
 *      * Redistributions of source code must retain the above copyright notice, this list of
 *        conditions and the following disclaimer.
 *
 *      * Redistributions in binary form must reproduce the above copyright notice, this list
 *        of conditions and the following disclaimer in the documentation and/or other materials
 *        provided with the distribution.
 *
 *      * Neither the name of Molecular the names of its contributors may be used
 *        to endorse or promote products derived from this software without specific prior
 *        written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * @version 1
 * @copyright 2007 Molecular
 * @author Glenn Barnett
 * @author Paul Irish
 * @link http://www.molecular.com/ Molecular
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 *
 *
 * To activate this functionality, place this file in your extensions/ 
 * subdirectory, and add the following line to LocalSettings.php:
 *     require_once("$IP/extensions/TagAsCategory/TagAsCategory.php");
 *
 * We also recommend changing the "Categories" label to "Tags".  This can be 
 * done by going to the "Special:Allmessages" page, and changing the
 * value of "pagecategories" from "{{PLURAL:$1|Category|Categories}}" to 
 * "{{PLURAL:$1|Tags|Tags}}" .
 */
 
if(! defined( 'MEDIAWIKI' ) ) {
   echo( "This is an extension to the MediaWiki package and cannot be run standalone.\n" );
   die( -1 );
} else {
 
    $wgExtensionCredits['other'][] = array(
        'name' => 'TagAsCategory',
        'author' =>'Molecular', 
        'url' => 'http://www.molecular.com',
        'description' => 'This Extension provides "folksonomy"-type tagging to articles, using Categories as the underlying functionality'
    );
 
    $wgHooks['ArticleViewHeader'][] = 'articleShowTagForm';
    $wgHooks['UnknownAction'][] = 'tagAction';
 
function articleShowTagForm(&$article)
{
 
    global $wgOut;
    global $wgScript;   
    global $wgMessageCache;
 
    # add localized messages for the "Add Tag" and "(none)" interface strings
    $wgMessageCache->addMessages(
        array (
            'addtag' => 'Add Tags',
            'notags' => '(none)'
        )
    ); 
 
    # load the localized messages into string variables
    $sAddTag = wfMsg('addtag');
    $sNoTags = wfMsg('notags');
    $sTags = wfMsg('pagecategories');               # defined by default as "{{PLURAL:$1|Category|Categories}}"
    $sCategoriesLink = wfMsg('pagecategorieslink'); # defined by default as "Special:Categories"
 
    # determine the URL for the form action
    $actionUrl = htmlspecialchars( $wgScript );        
 
    # generate the form HTML 
    $tagFormHTML=<<<ENDFORM
        <!-- TagAsCategory extension START -->
        <form action="{$actionUrl}" method="get" id="tagform" style="display: none;">
            <input type="hidden" name="title" value="{$article->mTitle->getPrefixedDBkey()}">
            <input type="hidden" name="action" value="tag">
            <input type="text" name="tag" value="" size="50" />    
            <input type="submit" value="{$sAddTag}" />
        </form>
        <script type="text/javascript">
 
        function moveTaggerBox(){
 
            if (document.getElementById('catlinks')){
                // if the Article is already in one or more categories, 
                // 'catlinks' will exist
                document.getElementById('catlinks').appendChild(document.getElementById('tagform'));
            }
            else 
            {
                // if 'catlinks' doesn't exist (the article is in 0 categories)
                // we must recreate the HTML 
                var div1=document.createElement('div');
                div1.setAttribute('id','catlinks');
                var p1=document.createElement('p');
                div1.appendChild(p1);
                var a1=document.createElement('a');
                a1.setAttribute('href',escape('{$sCategoriesLink}'));
                a1.setAttribute('title','{$sCategoriesLink}');
                p1.appendChild(a1);
                var txt1=document.createTextNode('{$sTags}');
                a1.appendChild(txt1);
                var txt2=document.createTextNode(': {$sNoTags}');
                p1.appendChild(txt2);
 
                document.getElementById('bodyContent').appendChild(div1);
                div1.appendChild(document.getElementById('tagform'));
                }
 
            document.getElementById('tagform').style.display = ''; // we defined it as hidden. show it once it's placed correctly
        }
 
        hookEvent("load", moveTaggerBox); // hookEvent() defined in wikibits.js
 
        </script>
 
        <!-- TagAsCategory extension END -->
ENDFORM;
 
    $wgOut->addHTML($tagFormHTML);
    return true;
}     
 
    function tagAction($action, $article) {
 
        global $wgUser; 
        global $wgRequest; 
 
        if($action == 'tag' && $wgUser->isAllowed('edit'))
        {
            # set wgUser??
            $content = $article->getContent();
 
            $newTagsString = $wgRequest->getVal('tag');

	    $newTagsArray = split(" ", $newTagsString);
	    foreach($newTagsArray as $newCategory) 
	    {
	    	if (strlen($newCategory) > 1)
	    	{
	    
            		$newCategoryString = "[[Category:" . $newCategory . "]]";
 
            		// if $content doesn't already contain the new Category string...
            		if (strpos($content, '$newCategoryString') == false) {
 
	               		 // edit the content, appending the new Category string
        	      	 	 // (with newlines) at the bottom of the article.
                		//
                		// additionally, flag the edit as an 'update', and suppress
                		// its inclusion in Recent Changes
 				$content .= "\n" . $newCategoryString;
 	    		}
           	 }
	    }
                	$article->doEdit(
                    		$content,
                    		"Added tags: '" . $wgRequest->getVal('tag') . "'",
                    		EDIT_UPDATE | EDIT_SUPPRESS_RC
                	);
 
            // view the article, and abort further processing by mediawiki (false)
            $article->view();
            return false;
        }
        else
        {
            // we don't have edit rights -- abort the operation, restoring
            // control to the default mediawiki behavior (true)
            return true;
        }
    }
}
 
?>

-JCamozzi

Why split on space? This means that you can't have categories with spaces. Would make more sense to split on a comma, or somesuch. - 220.233.239.174 09:20, 27 May 2008 (UTC)Reply

Prevent appearance on main_page?

[edit]

How to prevent it from appearing on certain pages like main_page?

Problems with HTML rewrite on 0 category case

[edit]

The div containing "Tags: (none)" and the "Add Tag" form are not controllable via main.css (monobook shows a box around the category section of a page). I would appreciate a solution to this. BTW: I have checked with IE6 and IE7. --82.113.113.82 09:07, 11 March 2009 (UTC)Reply

I found a solution for this: It was a CSS-referencing problem only - just don't create the attribute "id" to the div-tag, but the attribute "className", value "catlinks". This works fine and we do not need id "catlinks", since effectively, there exists no catlink.


Warning: Cannot modify header information

[edit]
headers already sent by (output started at /opt/lampp/htdocs/wiki.lan/wiki/extensions/TagAsCategory/TagAsCategory.php:188) 
in /opt/lampp/htdocs/wiki.lan/wiki/includes/WebResponse.php on line 16

I got that error in MW 1.14.0.

Problem when tagging

[edit]

I get this message when tagging a page :

Warning: Illegal offset type in isset or empty in /www/htdocs/w00845b3/nvcwiki.com/fr/includes/Title.php on line 128
Warning: Illegal offset type in /www/htdocs/w00845b3/nvcwiki.com/fr/includes/Title.php on line 150

Using MW 1.11.2

Thanks anyway for this very usefull extension !

--Dieudo 08:23, 24 August 2009 (UTC)Reply

specify to users that tag creation is case sensitive

[edit]

I made a quick modification to the extension. When you add a tag/category it is case-sensitive, so why not inform the user of that issue to save the admin less clean up work. Edit extensions/TagAsCategory/TagAsCategory.php and customize the 'Add Tag' variable. As you can see below, I added (Note:case sensitive) to it.

 # add localized messages for the "Add Tag" and "(none)" interface strings
    $wgMessageCache->addMessages(
        array (
            'addtag' => 'Add Tag (Note:case sensitive)',
            'notags' => '(none)'
        )
    ); 

(hint hint nudge nudge): It would be awesome to have some type of AJAX suggest list of tags to choose from when typing a tag in to the input box that can translate case-insensitivity to the correct tag/category.

Thanks for the awesome extension! --SomaticJourney 09:01, 6 February 2010 (UTC)Reply


Language variables not substituted

[edit]

Since Mediawiki 1.16, I am getting literally "&lt;notags&gt;" and "<add tag>" instead of "Add Tag" and "(none)", see this screenshot

This happens in English as well as in German. It worked fine in previous MediaWiki verions. Does anyone know a fix for this?

Harald, 22:14, 7 January 2011 (UTC)

The solution is to add the text messages along with the corresponding language:

    $wgMessageCache->addMessages(
        array (
            'addtag' => 'Add Tag',
            'notags' => '(none)'
        ),
        'en'
    );
    $wgMessageCache->addMessages(
        array (
            'addtag' => 'Tag hinzufügen',
            'notags' => '(keine)'
        ),
        'de'
    );

91.66.77.149 12:13, 23 May 2011 (UTC)Reply

Only shows in pages with categories

[edit]

The "add tag" template only appears on pages that already have Categories attached to them. Is there any way to make it so that every page has the template appear?

Nabil Boutaleb, 17:43, 27 April 2011 (UTC)

The best way to achieve this is by editing $IP\skins\common\shared.css file. Search for .catlinks-allhidden and remove "display: none; " .. this would do the trick, the only problem is that even at your first page you would see Ädd Tag" option :( But this could be presented as cool tag cloud on your main page :)

Dheeraj, 1:33, 12 Nov 2012


Reason for this is that a CSS-class ".catlinks-allhidden" sometimes prevents it from showing up. One solution is to change some part of the javascript to move the tag-form outside of the category-div. Instead of

document.getElementById('catlinks').appendChild(document.getElementById('tagform'));

write:

document.getElementById('catlinks').parentNode.appendChild(document.getElementById('tagform'));

Doesn't look as nice though.. 91.66.77.149 12:17, 23 May 2011 (UTC)Reply

I'd also love to see this extension on pages that don't have categories yet. Will this be implemented anytime soon? Cheers --Fxk2 10:34, 8 June 2011 (UTC)Reply

Code fixes for 1.20?

[edit]

Great potential with this extension. But it doesn't work in newer versions. Anyone have a working PHP code for 1.20?

Please paste it here!