LocalSettings.php is probably not the right place for doing that.

Magic words are added using extensions.

However, magic words are really necessary only when the custom content that
you want to add is so complicated that it can be generated only by
complicated PHP code or when you need a convenient way to use the same
functionality on many wikis.

If you need it only for one wiki, and the content is not exceptionally
complicated, then it's quite possible that you can achieve the thing you
want simply by creating a template on the wiki itself. Read more about it
here:
https://www.mediawiki.org/wiki/Help:Templates
https://en.wikipedia.org/wiki/Help:Template

Templates are written using the same wikitext as usual wiki pages. If you
want to write it using an actual programming language, install the
Scribunto extension, and write a module in Lua. See:
https://www.mediawiki.org/wiki/Extension:Scribunto

--
Amir Elisha Aharoni · אָמִיר אֱלִישָׁע אַהֲרוֹנִי
http://aharoni.wordpress.com
‪“We're living in pieces,
I want to live in peace.” – T. Moore‬


‫בתאריך יום ד׳, 29 בדצמ׳ 2021 ב-12:46 מאת ‪Patrick Schleizer via
MediaWiki-l‬‏ <‪mediawiki-l@lists.wikimedia.org‬‏>:‬

> Could you explain please how to add a custom magic word to mediawiki
> LocalSettings.php?
>
> Example:
> When writing in the wiki {{CUSTOM_VARIABLE}} it will expand to:
> custom-content
>
> In other words... I want to set in LocalSettings.php
>
> $CUSTOM_VARIABLE = "custom-content";
>
> and that custom variable should then be available inside the wiki be as
> {{CUSTOM_VARIABLE}}.
>
> If avoidable, writing a mediawiki extension should be avoided.
>
> Is this possible?
>
> Cheers,
> Patrick
> _______________________________________________
> MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org
> To unsubscribe send an email to mediawiki-l-le...@lists.wikimedia.org
>
> https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
>
_______________________________________________
MediaWiki-l mailing list -- mediawiki-l@lists.wikimedia.org
To unsubscribe send an email to mediawiki-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/

Reply via email to