On 24/02/10 8:19 PM, Dmitriy Sintsov wrote:
> * Evgeny Fadeev<[email protected]>  [Mon, 22 Feb 2010 12:23:20
> -0800]:
>    
>> Hello,
>>
>> here is what I would like to accomplish:
>>
>> somesite.net/<namespace>/<page_name[/subpage]>[?optional parameters]
>>
>> Is there a way to achieve that?
>>      


You should do this with rewrite rules. MediaWiki expects a 
properly-formed MediaWiki title to come in on the 'title' GET/Post 
parameter. You will need to rewrite /namespace/page_name to 
?title=namespace:page_name, and you will need to handle the case where 
there is no namespace.
> Hi Evgeny!
> Take a look at the code of includes/SpecialPage.php, methods (from
> v1.15.1 I just use)
>       static function executePath(&$title, $including = false ) {
>               global $wgOut, $wgTitle, $wgRequest;
>               wfProfileIn( __METHOD__ );
>
>               # FIXME: redirects broken due to this call
>               $bits = explode( '/', $title->getDBkey(), 2 );
>               $name = $bits[0];
>               if( !isset( $bits[1] ) ) { // bug 2087
>                       $par = NULL;
>               } else {
>                       $par = $bits[1];
>               }
> ...skip...
>               // Execute special page
>               $profName = 'Special:' . $page->getName();
>               wfProfileIn( $profName );
>               $page->execute( $par );
>               $page->execute( $par );
>               wfProfileOut( $profName );
>               wfProfileOut( __METHOD__ );
>               return true;
>       }
> That $par is a parameter after slash, passed to execute() method. If you
> want to build your own special page, which may take it's parameter from
> "slash subpage" string, you have simply to extend SpecialPage class and
> implement your function execute(). If you want to use such parameter
> somewhere else, you probably have to use Title::getSubpageText().
> Request query parameters (after '?') can be obtained by using $wgRequest
> instance of WebRequest object methods getInt('paramname'),
> getCheck('paramname'), getText('paramname').
>    

That doesn't sound at all what the OP is trying to do.

-- 
Andrew Garrett
[email protected]
http://werdn.us


_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to