User talk:Brion.finlay/PathFunctions

From mediawiki.org
Latest comment: 11 years ago by 91.223.204.4

Hi Brion.finlay
Do you mean I will see the string "Test" in page A after I do the following:

  1. Use "{{ #PAGENAME:{{PAGENAME}} }}" in Template:Test.
  2. Use "{{Test}}" in page A.

Right? If it's true, I'm failed with using this extension.

My Environment:

  • MediaWiki: 1.11.0
  • Win XP
  • The AppServ Open Project - 2.5.7 for Windows
    • Apache Web Server Version 2.2.3
    • PHP Script Language Version 5.1.6
    • MySQL Database Version 5.0.24a

---Roc michael 23:13, 31 May 2008 (UTC)Reply

Hi,

just encountered following issue:

PHP Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in extensions/PathFunctions/PathFunctions.php on line 121

After commenting out function namespace on line 121 no parse error is detected. Is there some kind of keyword-conflict?

Using MW 1.16.5, PHP 5.3.3 (cgi-fcgi), MySQL 5.1.61 and ParserFunctions 1.4.1 (Version(115010)

Edit: Solved by myself :) Problem: with PHP 5.3 the keyword namespace comes into play...
ergo: one has to rename the function namespace in line 121 to sth else.
unified diffs:
--- PathFunctions.php.new	2012-04-23 17:52:48.120763706 +0200
+++ PathFunctions.php	2012-04-23 18:07:07.574796819 +0200
@@ -118,7 +118,7 @@
                 return $title->getSubjectPage()->getPrefixedUrl();
         }
  
-        public static function name_space( &$parser , $path = false ) {
+        public static function namespace( &$parser , $path = false ) {
                 $path = trim($path);
                 $title = $path ? Title::newFromText( $path ) : $parser->mTitle;
                 return strtr( $title->getNsText() , '_' , ' ' );
@@ -231,7 +231,7 @@
         $wgParser->setFunctionHook( 'talkpagenamee', array( 'ExtPathFunctions', 'talkpagenamee' ), $flags );
         $wgParser->setFunctionHook( 'subjectpagename', array( 'ExtPathFunctions', 'subjectpagename' ), $flags );
         $wgParser->setFunctionHook( 'subjectpagenamee', array( 'ExtPathFunctions', 'subjectpagenamee' ), $flags );
-        $wgParser->setFunctionHook( 'namespace', array( 'ExtPathFunctions', 'name_space' ), $flags );
+        $wgParser->setFunctionHook( 'namespace', array( 'ExtPathFunctions', 'namespace' ), $flags );
         $wgParser->setFunctionHook( 'namespacee', array( 'ExtPathFunctions', 'namespacee' ), $flags );
         $wgParser->setFunctionHook( 'talkspace', array( 'ExtPathFunctions', 'talkspace' ), $flags );
         $wgParser->setFunctionHook( 'talkspacee', array( 'ExtPathFunctions', 'talkspacee' ), $flags );

--- PathFunctions.i18n.php.new	2012-04-23 17:53:26.442752290 +0200
+++ PathFunctions.i18n.php	2012-04-23 18:07:44.923786300 +0200
@@ -24,7 +24,7 @@
         'talkpagenamee' => array( 0, 'talkpagenamee' ),
         'subjectpagename' => array( 0, 'subjectpagename' ),
         'subjectpagenamee' => array( 0, 'subjectpagenamee' ),
-        'namespace' => array( 0, 'name_space' ),
+        'namespace' => array( 0, 'namespace' ),
         'namespacee' => array( 0, 'namespacee' ),
         'talkspace' => array( 0, 'talkspace' ),
         'talkspacee' => array( 0, 'talkspacee' ),

--91.223.204.4 16:26, 23 April 2012 (UTC)Reply

---tzr


—The preceding unsigned comment was added by 91.223.204.4 (talkcontribs) 15:41, 23 April 2012