Jump to content

Topic on Project:Support desk

How to embed and load a PHP webpage in a MediaWiki webpage?

11
182.232.144.129 (talkcontribs)

MediaWiki 1.36.1.

I have an empty MediaWiki webpage in which I want to embed and load a PHP file.

  • I tried to do so with XMLHttpRequest but the CSS wasn't loaded
  • I tried to do so with iframe but it was rendered awfully and I didn't have time to keep "playing" with the iframe tags (unique?) attributes
  • I can link to the PHP webpage directly from the sidebar menu but than it would be a standalone webpage lacking all the graphics coming with my MediaWiki theme (logo, etc.) which I don't want

Perhaps fetch is better than XMLHttpRequest (I didn't try).

Anyway, how would you embed and load a PHP file in a MediaWiki webpage?

Bawolff (talkcontribs)

You could make a custom special page: manual:special pages

The other major option are iframes. Remember that iframes can only access cookies that are marked SameSite=none and have the secure flag. The only attributes you really need src, and maybe border=0. And width/height.

49.230.30.157 (talkcontribs)

Creating a webpage named Special:Contact us would feel to me as a user experience problem unless there is some decent way to control the naming of the webpage (removing the Special: namespace from the actual name).

Bawolff (talkcontribs)

Special pages can be transcluded as templates. For example you can put {{Special:recentchanges}} on a page. Also its just the url, the special: prefix isn't shown on the page and most people would follow a link not manually type it in.

49.230.29.35 (talkcontribs)

Okay,

Another problem I have with creating a custom special page for this php-embeded webpage is that (as far as I know) special pages require editing LocalSettings.php which in my case is quite default and I prefer "not to touch" unless it's about some "serious stuff".

Am I right, or just having an anxiety on the matter? :)

49.230.28.107 (talkcontribs)

Was I wrong anywhere?

Bawolff (talkcontribs)

It would involve touching LocalSettings.php

79.176.20.41 (talkcontribs)

A Codidact Software Development discussion is currently being formed about the iframe problem first mentioned in this very thread:

software.codidact.com/posts/285235

79.176.20.41 (talkcontribs)

@Bawolff you might have an opinion if this problem with iframe is a bias from MediaWiki, a bug in iframe itself, or something else.

Bawolff (talkcontribs)

It sounds like its working the way its supposed to. The width (as a percent) is relative to the width of the containing element minus any relavent margins.

79.176.20.41 (talkcontribs)

Indeed, as Bawolff said, it was a relationality issue.

Changing @media screen and (min-width: 922px) to @media screen and (min-width: 720px) helped.

For anyone interested, I have described more in the Codidact discussion linked above.

Reply to "How to embed and load a PHP webpage in a MediaWiki webpage?"