[00:08:14] Can PHP code be embedded in an article page? [00:09:27] Embedded how? [00:09:34] Embedded to be run? Embedded for viewing? [00:10:06] Ostensibly you could write an extension that does that, but otherwise, no. [00:10:07] inline to be run [00:10:17] The closest thing today is Scribunto. [00:10:21] Which is Lua. [00:10:32] closest safe thing* i guess [00:11:58] it looks like a hook could do it as well, but it seems rather complex to get it set up [00:12:08] and it would be generally unsafe [00:12:20] executing arbitrary code is cool :) [00:13:18] There's also https://www.mediawiki.org/wiki/Extension:PhpTags although i would definitely suggest just using lua [00:13:47] MediaWiki:Common.js would be rather unsafe as well, and difficult to test without crashing things [00:14:02] also, an XY problem here too, what are you actually trying to do [00:14:20] Common.js is indeed unsafe, but its really hard to put toothpaste back into the container [00:14:46] Basically I would like to execute a script after the page is loaded to modify attributes such as 'hidden' based on a parameter. [00:15:23] attributes such as "hidden"? Where is that "attribute" set? [00:15:41] it would modify the page based on the user selected software version [00:16:12] I would have sections with div names [00:17:15] "user selected software version"? [00:17:25] in the first phase, the user would set the version from a pull-down list. that choice would be saved in a cookie [00:17:43] if you're suggesting what I think you are, either you're going to need a full extension communicating with some PHP on the backend, or you want a Javascript solution [00:18:23] that said, cppreference.com has a mechanism for displaying different versions of statements made based on the standard those statements apply to [00:18:42] I haven't looked into the details but I gather that's done in Javascript [00:19:09] for example, if the doc covered versions 3.7, 3.8, 3.9, and 3.10, having the user choose what version they wanted to see would hide the sections which did not apply [00:20:06] I can do it in JS on an Indico website for GNU Radio [00:20:06] yes, a Javascript solution is called for there [00:21:38] so I'll look at cppreference as an option [00:22:19] Then there's the MediaWiki wiki solution, which has little sidebars to the right for versions of interest for a specific statement [00:22:26] what is the best MediaWiki only approach? using a hook? [00:23:10] to do what? [00:23:17] for the sidebar, is that a plugin? [00:23:47] nope, just a template [00:23:56] wiki template [00:26:05] my impression is that a hook could allow me to run a script on a rendered page before is was displayed. Is that valid? [00:26:38] that would probably kill your cache, but sure [00:26:53] at that point you're constructing your own extension regardless [00:29:43] kv4fv: you want a js solution here [00:30:03] dropdown sets a cookie, your js shows/hides the sections appropriate to that selection [00:30:17] I can do JS or PHP as needed. [00:30:19] a php solution would not work the way you want it to work [00:30:56] php hooks like what you're thinking of are run on parse, and pages (in a proper setup) are only ever parsed when they are edited/saved. After that the cached html is given to viewers [00:32:06] so if you need something to change dynamically potentially each time the page is viewed, php is the wrong way of going about it [00:32:15] your understanding is correct: "dropdown sets a cookie, your js shows/hides the sections appropriate to that selection" [00:32:33] so this would be just before displaying the page [00:32:55] on document ready in the case of js, but sure [00:34:25] OK, so there seem to be three possible solutions: [00:35:25] 1- cppreference; 2- mediawiki sidebar; 3- doc ready and run a JS script [00:35:42] I have no idea what you mean by 1 or 2 [00:35:58] there's the tabberneue extension also -> do tabs instead [00:36:36] but some sort of js-based solution is appropriate here. exactly how you implement that is up to you [00:38:11] Izno suggested solutions 1 and 2 about 20 minutes ago [00:39:18] oh I see [00:39:32] the option 2 doesn't actually involve hiding anything, it just breaks everything out into its own section [00:40:39] I'd like to hide things to reduce the clutter (and keep the user from reading the wrong info) [00:41:38] is the document ready a hook? [00:43:12] no, hooks are a php concept [00:43:39] you would either put the js code in your MediaWiki:Common.js page or you would make use of [[Extension:Gadgets]] and make your code into a loaded-by-default gadget [00:45:28] I will study the [[Extension:Gadgets]]. Thank you for your help! [02:50:35] is there some way i can prevent certain spellings of a Category? for instance we have a "How To" category and I want to prevent people accidentally using "How to" with the incorrect capitalisation [02:54:28] Effectively, just Special:WantedCategories [02:54:37] You can set up a bot that monitors for common misspellings if you want. [02:55:12] you can create protect it and hope people see the redlink [02:55:25] if there's one that's a specific problem [02:56:27] using https://commons.wikimedia.org/wiki/Help:Gadget-HotCat can also help prevent misspellings, by providing a search feature [02:57:24] what if i make the misspelling a hidden category? [02:57:38] That's the worst option [02:57:59] oh ok [02:57:59] it's the least visible while actually editing [02:58:09] Because then you can't use the only tool you do have, and your page is still in the wrong place and people probably won't see it. [02:58:41] ok thanks [03:02:22] do i have to install HotCat? [03:02:37] oh, i have eto have the gadgets extension [03:11:06] i am loading the Gadgets extension, but i don't understand how to enable hotcat [04:50:30] k-man: on a wiki that has hotcat and gadgets, there should be an "export" feature for the hotcat gadget. click on that and it gives you instructions on how to import/install into your wiki [04:50:44] after you install it, enable hotcat in your Preferences (assuming it isn't a default gadget, which it probably is not) [04:51:38] one caveat: the export feature makes a copy of the js, which means you won't get updates as they're made to the source wiki (usually, depends exactly on how the gadget is set up though) [04:52:04] so if the author/maintainer of hotcat has installation instructions for 3rd-party wikis, it may be better to follow those in order to ensure you track the latest code [04:52:20] ok thanks [04:52:24] i'll read up on that later [06:19:59] Hello, I installed MediaWiki 1.38 and Vector-2022 but there seems to be some style issue. The mw-navigation is not showing as https://www.mediawiki.org/wiki/MediaWiki e.g. navigation under page title and simple text instead of buttons. Please see the attached screenshot comparison and please suggest any fix to achieve the same style. Screenshot: [06:19:59] https://imgur.com/a/gicvBy2 [06:24:29] yours is at the bottom? [06:24:39] Mine is at the top [06:24:52] Below is Mediawiki.org [06:25:20] the top is old Vector, not 22 [06:25:51] unless it's got fixed width, in which case the skin is just not at 1.39 [06:26:10] https://www.mediawiki.org/w/index.php?title=MediaWiki&useskin=vector is vector [06:26:18] No actually in my Localsettings.php I activated vector-2022 and the entire skin was changed instead of the navigation. [06:26:53] https://www.mediawiki.org/w/index.php?title=MediaWiki&useskin=vector-2022 is vector-2022 [06:28:11] When I'm using above url with my site and page name it's showing the old navigation with new skin. [06:29:08] It is normal [06:29:26] The 1.38 version of Vector-2022 does not have the tab changes implemented [06:29:34] It was added somewhere between 1.38-1.39 [06:30:48] My version is 1.38.4 [06:31:12] yes, the .4 is generally a maintenance or security release [06:31:13] So you mean i need to wait for the 1.39 release. [06:31:20] yes [06:31:34] Ok thank you for the information. [06:31:35] which should be Soon [06:31:43] great :) [06:34:18] Ok so once 1.39 is released can I update the Vector skin or I have to upgrade to 1.39 entirely? I just upgraded to 1.38 yesterday. [07:03:03] Entirely, Vector usually bump its requirement as soon as release cutoff (a date months before a MW version is schedule to release) [15:30:43] Hello everyone. I was trying to setup subdomain for mobile as explained on this page https://www.mediawiki.org/wiki/Extension:MobileFrontend/Configuring_browser_auto-detection but I'm not using Varnish so what code I need to put instead? Thanks [15:32:05] If I only add $wgMobileUrlTemplate = '%h0.m.%h1.%h2'; to my localsettings.php it changes the domain but not changing the skin when I click on mobile view. [15:36:25] Any help? [15:43:28] I only want to know that what code I need to put and where instead of the code mentioned for Varnish. [16:59:26] Hello everyone I'm using MobileFrontend and was trying to enable the subdomain for mobile view but since I'm not using Varnish what code should I add and where as mentioned in this paragraph? https://www.mediawiki.org/wiki/Extension:MobileFrontend/Configuring_browser_auto-detection#Detection_using_Varnish:_mobile_site_on_another_domain [16:59:59] Simply adding $wgMFAutodetectMobileView = true; does the trick but when on desktop I click on mobile view it's not showing the mobile skin. [23:48:22] Tbh.. you are better off with a skin like chameleon. Native bootstrap support, meaning you are in full control of mobile, tablet or desktop views.