Extension talk:SelectCategoryTagCloud

Errors
I've got an errors caused by SelectCategoryTagCloudSuggest.php: 1 result set(s) not freed An other thing is the structure of this php-program, where at first query is executed and later checked if searchString perhaps is NULL. I've fixed the Error with mysql_free_result and changed the structure a little bit. My opinion is that this script may should more look like that: if(isset($_GET['q'])) { $searchString = mysql_real_escape_string($_GET['q']); if($searchString != NULL) { $sql = mysql_query("SELECT DISTINCT cl_to as cats FROM categorylinks WHERE cl_to LIKE '".$searchString."%'"); $suggestStrings=array; while($row = mysql_fetch_assoc($sql)) { array_push($suggestStrings,$row['cats']); }       echo implode(";",$suggestStrings); //echo $suggestStrings; if(mysql_num_rows($sql) == 0) { //echo "No results found"; }       mysql_free_result($sql); } }

The last problem is to have redundant DB-Access-Parameters on the top of the script, but the same data is provided by LocalSettings.php. Is there no way to require LocalSettings.php to use this params? Thanks -Stefan- ---79.211.199.108 14:46, 14 September 2007 (UTC)

Thanks for the suggestion, I included it in version 1.1 and updated the source file. Regarding the database credentials, the page is basically a standalone program and not part of the MediaWiki code. I have yet to find a work-around to get to the details in LocalSettings.php. Any suggestions are welcome. Thanks, --Lindele 16:10, 14 September 2007 (UTC)

It's me again I've found a Solution but its a bad one for a rich extended mediaWiki:  & Manuel Schneider , Daniel Friesen http://wiki-tools.com * @licence GNU General Public Licence 2.0 or later * @description Adds a category selection tag cloud to the edit and upload pages and enables a Google Suggest like completion of categories entered by the user. *

//CONFIGURE WITH YOUR LOCAL CREDENTIALS define( 'MEDIAWIKI', true); require_once('../../includes/Defines.php'); # Grabb Defines to avoid Errors in LocalSettings require_once('../../LocalSettings.php'); # Load LocalSetting with all Settings but all Extensions (very dirty) global $wgDBserver,$wgDBname,$wgDBuser,$wgDBpassword;
 * 1) Set MEDIAWIKI to avoid the "Part Of mediaWiki-Errors"
 * 1) Does it not running under MediaWiki?
 * 1) so wie can load from mediaWiki globals

mysql_connect($wgDBserver,$wgDBuser,$wgDBpassword);

mysql_select_db($wgDBname);

if(isset($_GET['q'])) { $searchString = mysql_real_escape_string($_GET['q']); if($searchString != NULL) { $sql = mysql_query("SELECT DISTINCT cl_to as cats FROM categorylinks WHERE cl_to LIKE '".$searchString."%'"); $suggestStrings=array; while($row = mysql_fetch_assoc($sql)) { array_push($suggestStrings,$row['cats']); }       echo implode(";",$suggestStrings); //echo $suggestStrings; if(mysql_num_rows($sql) == 0) { //echo "No results found"; }       mysql_free_result($sql); }

} ?>

This works, but slowes up the CategorySuggest, because every extension and every setting is allocated per one request of suggest. I think mediaWiki it self, should perhaps better provide a distributed Setting, something like "DatabaseSettings.php" as separate Solution. So you can require this Config-File in LocalSettings.php and every other Application that need this Params without running directly under mediaWiki, within one of the few Hook-Callbacks. An other way could be to use the separat AdminSetting.php file, but not everyone might set this config file. All Solutions are dirty Solutions, in exeption of creating a DatabaseSettings.php which will be included in LocalSettings and SelectCategoryTagCloudSuggest but that will make the installation quite more difficult.

The native reason because I browsed to this talkpage follows...

Setting wgSelectCategoryRoot has no Effect

 * I wanna make a Playground Namespace with Playground Categories.
 * There for I've created a special categorie "Playground" wich should be the root category for NS_PLAYGROUND
 * My setting of wgSelectCategoryRoot doesnt have any effect, so I've read the Code and found out, that there is no usage
 * of the parameter wgSelectCategoryRoot in SelectCategoryTagCloudFunctions.php
 * Than I've seen the Code:

$m_allCats = fnSelectCategoryGetAllCategories;
 * and thats the only thing where categories are grapped from database, for the cloud.
 * There is no fnSelectCategoryGetAllSubCategoriesUnderRoot($wgSelectCategoryRoot[$current_namespace]) or e.g.
 * Is the wgSelectCategoryRoot setting only for normal SelectCategory-Extension available and not for this one?

Sorry my english is perhaps a little bit roughly :)

Thanks again -Stefan- 79.211.199.89 10:40, 25 September 2007 (UTC)