Page MenuHomePhabricator

SemanticTitleHooks.php: Undefined class constant 'TYPE_STRING'
Closed, DeclinedPublic


I get this error, and the page_props table is not populated with DISPLAYTITLE content...

[installdir]/extensions/SemanticTitle/SemanticTitleHooks.php: Undefined class constant 'TYPE_STRING'


Event Timeline

Cainamo created this task.Jul 31 2019, 12:05 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 31 2019, 12:05 PM
Aklapper added a comment.EditedJul 31 2019, 12:20 PM

Hi @Cainamo, thanks for taking the time to report this and welcome to Wikimedia Phabricator!

Please always provide steps to reproduce a problem and include exact version information (MediaWiki; Semantic MediaWiki; the extension itself). See for more information - thanks!

Environment and versions:

MariaDB: 10.3.15
PHP: 7.2.20
MW: 1.33.0
SMW: 3.0.2
Semantic Title: 4.0
Display Title: 2.0


wfLoadExtension( 'DisplayTitle' );
wfLoadExtension( 'PageForms' );
wfLoadExtension( 'SemanticMediaWiki' );
wfLoadExtension( 'SemanticTitle' );

$wgAllowDisplayTitle = true;
$wgRestrictDisplayTitle = false;

$wgEnableParserCache = false;
$wgCachePages = false;

$wgSemanticTitleProperties = array(

NS_MAIN=>"Har visningstittel"



$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;

Freshly installed wiki... not able to make the semantic property "Har visningtittel" display as page "name"....
Page00001 has a semantic property of type Har visningstittel with value "Produkt", but when i browse the wiki, only Page00001 i shown. The error disappears if I change the property name in LocalSettings.php.

Thanks in advance :)


I see that you are using both the Semantic Title extension and the Display Title extension. You should not use both. Semantic Title is an older extension that should probably be archived at this point. Remove that extension and use only the Display Title extension. You will set the page's display title using the DISPLAYTITLE magic word documented here.

The "Undefined class constant 'TYPE_STRING'" error in Semantic Title is because TYPE_STRING is deprecated in newer versions of Semantic MediaWiki. But, rather than fixing that, it is probably better to archive Semantic Title.

As written by Cindy, Semantic MediaWiki 3.0 has deprecated TYPE_STRING. The code in SemanticTitle would need to be updated.
See and for an example how to do that...

Thank you, @Aklapper. I'm in the process of archiving SemanticTitle in favor of DisplayTItle.

Cainamo added a comment.EditedJul 31 2019, 2:54 PM

Thanks @cicalese & @Aklapper Now I made it :) I removed all the Semantic Title config in LocalSettings and put the DISPLAYTITLE magic word into one page - and it worked right away. However, is it possible to make a template that always puts in DISPLAYTITLE followed by a semantic property value on the current page - ie {{DISPLAYTITLE:*HasUserdefinedPageName*}}?

Semantic MediaWiki already has functionality where the Property "Display title of" gets set to the display title on any page that uses the DISPLAYTITLE magic word to set the display title. So, you set the display title first, and the property gets set automatically.

cicalese closed this task as Declined.Jul 31 2019, 3:48 PM

Extension SemanticTitle is being archived. Use extension DisplayTitle instead.

@Cainamo, thank you for your contribution. I'm glad that DisplayTitle is working for you!

Sorry @cicalese , I didn't understand how to use the |Display title of=MyChosenName. Tried to read and fin examples, but without luck...

From page


Has description=bla bla bla
Display title of=I want this to be shown as page title


From template

</noinclude><includeonly>{| class="wikitable"

{{DISPLAYTITLE}} <-- Is this the way to do it?

! Has description

[[Has description::{{{Has description|}}}]]

It looks like what you need in your case is {{DISPLAYTITLE:{{{Display title of|}}}}} assuming that "Display title of" is one of the named parameters passed into your template "Tjeneste". That will set the display title on the page, which will allow the DisplayTitle extension to use it for the link text in links and cause the Semantic MediaWiki extension to give the value to the "Display title of" property.

Cainamo changed the task status from Declined to Resolved.Jul 31 2019, 5:15 PM

@CCicalese_WMF Finally - thanks a lot :)

I modified the schema (Page Forms) so it now receives a value and puts it into "Display title of", and added {{DISPLAYTITLE:{{{Display title of|}}}}} to the template, and voila!

Aklapper changed the task status from Resolved to Declined.Jul 31 2019, 5:25 PM

(This task is declined as SemanticTitle will not receive a fix in its codebase)