UI Development Hints

Quicks tips for developing on the UI.

  • don't use htmlentities(), it barfs on utf-8, use htmlspecialchars()
  • GET,POST,COOKIE vars should be accessed through wgRequest->getInt, getBool, getVal, etc

 

How to combine titles

$to = 'some/encoded/text/path';
$titleText = Article::combineName($to, wfEncodeTitle($newTitle));
$ToTitle = Title::newFromText($titleText);

How to split a title

Article::splitName($encodedPathWithTitle, $titlePath, $titleName);
$parentPath = $Title->getParentPath();
$pagePath = $Title->getPathlessText();

 

How to get the title text

$Title->getPrefixedDbKey();
$Title->getPrefixedText();

How to build title urls

$Title->getLocalUrl();
$Title->getLocalUrl('foo=bar&other=baz');

How to get the localized namespace name

$wgLang->getNsText(NS_USER);

 

 

Tag page
You must login to post a comment.