Thread:Project:Support desk/Question on Title Class properties/reply (4)

To make your code dynamic, you would need the current page's title object from the global variable $wgTitle or (in newer MediaWiki) from the request context.

Once you have that you can use the  method to get the part of the title you want. So instead of $tectitle = Title::newFromText('Tec:Seite'); you would have (note that this is untested): global $wgTitle; $tectitle = Title::newFromText( 'Tec:' . $wgTitle->getBaseText );