Extension talk:MetaKeywords
Hello! What I need to change to make the same extension, but not by namespaces. I need different meta by categories.
--Tarasius.ua 17:02, 5 August 2010 (UTC)
1.16.2
editI was able to get this to work with mediawiki 1.16.2 thusly:
--- MetaKeywords.php 2010-07-28 02:51:48.000000000 -0600
+++ /new/MetaKeywords.php 2011-04-05 20:04:38.000000000 -0600
@@ -43,7 +43,7 @@
}
//Adds customised keywords after the pagename of the <meta keywords> tag
-function wfMetaKeywordOutput( &$out ){
+function wfMetaKeywordOutput( $out ){
global $wgTitle, $wgMemc;
$ns = $wgTitle->getNamespace();
@@ -52,7 +52,7 @@
if($opts === null ){ //Reload if not in cache
$opts = wfMetaKeywordInput( 'keywords' );
}
- $pagename = array_shift( $out->mKeywords );
+ $pagename = $out->getPageTitle();
if( array_key_exists( $ns, $opts ) && $opts[$ns] ){ //Namespace specific keywords
array_unshift( $out->mKeywords, $opts[$ns]);
@@ -117,7 +117,7 @@
}
//Updates the cache if [[MediaWiki:Metakeywords]] or [[MediaWiki:Metadescription]] has been edited
-function wfMetaKeywordClearCache( &$article, &$wgUser, &$text ) {
+function wfMetaKeywordClearCache( $article, $wgUser, $text ) {
global $wgMemc;
$title = $article->mTitle;
Problem with 1.1.18?
editI just added this extension to my MediaWiki installation 1.1.18 and I now get the following error for lines 56, 58, 70, 72 when I view any page on my wiki. Any ideas?
Warning: array_key_exists() [function.array-key-exists]:
The second argument should be either an array or an object in /path/to/wiki/extensions/MetaKeywords/MetaKeywords.php on line 56
All download links are dead at the moment.
editCouldn't even try this extension. However, the Description2 extension works great for meta descriptions on 1.19. Craig131 (talk) 07:21, 5 August 2012 (UTC)
Version 1.22.6
editWith Version 1.22.6 the description seems to work. The keywords don't show up, whwn you look at the sourcecode of the mainpage. Any explantion?
The debug infoermation says: Warning: array_shift() expects parameter 1 to be array, null given in /home/www/web64951/html/extensions/MetaKeywords/MetaKeywords.php on line 47
Warning: array_unshift() expects parameter 1 to be array, null given in /home/www/web64951/html/extensions/MetaKeywords/MetaKeywords.php on line 52
All the best from Dschermennie Bernd