Extension talk:Include

Jump to navigation Jump to search

About this board


/Archive 1

Summary by Quantum7

The extension can be used within templates by using the #tag:include function

Quantum7 (talkcontribs)

I would like to make a template that uses the include link. Something like

(Template:IncludeMyFile) <include src="http://example.com/{{{1}}}">

However, the plugin parses the include statement prior to transclusion/substitution, so the argument never gets inserted and I get an error due to "http://example.com/{{{1}}}" not being found.

Is there a trick to delay evaluation of the include until after transclusion?

Tacsipacsi (talkcontribs)

You can use {{#tag:include||src=http://example.com/{{{1}}} }} (note the double pipe—the first parameter of this form must be the content of the tag which is empty for <include>).

Syntax highlighting does not work any longer

2 (talkcontribs)

The script still includes the path "SyntaxHighlight_GeSHi/geshi/geshi.php".

In the current version of the SyntaxHighlight_GeSHi extension this path does not exist.

Is there a Chance that the script will be adapted to the new Extension?

Tacsipacsi (talkcontribs)

You can either create a pull request to the GitLab repository, or use a workaround: if you set the $wg_include_geshi_install_path variable in LocalSettings.php to the right path (before including the extension), the script will load that instead of the old GeSHi version. However, this extension haven't been updated for more than three years, so it's probably deprecated at many other points, too.

Reply to "Syntax highlighting does not work any longer"
Evert (talkcontribs)
Reply to "Parameter being ignored?"
Peachey88 (Flood) (talkcontribs)

Please forgive me if I am incorrect. I am a newbie at programming.

As I added to the see also section:

If these extensions allow the editor to embed dynamic pages in a wiki, why use this extension which only allows an editor to add static (unchanging) text content?

With Iframe html, for example you can:

  1. edit a wiki inside of a wiki, or
  2. add external forum comments inside a page of your wiki.
  3. browse youtube on a page of your wiki.
  • This extension allows one to seamlessly integrate a piece of text or HTML within a page in addition to using iframes. I use it to include pieces of code, and the extension also does the syntax highlighting for me, it's basically great. Iframes are great too, but they do different things.

This post was posted by Peachey88 (Flood), but signed as Adamtheclown.

Reply to "Why is this extension needed?"

It does not work: Warning: Parameter 3 to render_include() expected to be a reference [solved]

Peachey88 (Flood) (talkcontribs)

If your browser log file shows

[error] PHP Warning: Parameter 3 to render_include() expected to be a reference, value given in .../includes/parser/Parser.php on line 3333

you need to apply the

patch for PHP 5.3.x

--- secure-include.php.orig	2011-05-22 04:54:45.000000000 +0200
+++ secure-include.php	2011-05-22 04:53:16.000000000 +0200
@@ -669,7 +669,7 @@
  * @access public
  * @return string
-function ef_include_render ( $input , $argv, &$parser )
+function ef_include_render ( $input , $argv, $parser )
     global $highlighter_package;
     global $wg_include_allowed_features;
  • tested for MediaWiki trunk 1.19alpha (r88557) and PHP 5.3.6

This post was posted by Peachey88 (Flood), but signed as Wikinaut.

Peachey88 (Flood) (talkcontribs)
Reply to "It does not work: Warning: Parameter 3 to render_include() expected to be a reference [solved]"
Peachey88 (Flood) (talkcontribs)

Is it possible to include a local file timestamp? To keep track when the file was last modified

This post was posted by Peachey88 (Flood), but signed as

Peachey88 (Flood) (talkcontribs)

done in version 0.10-beta ; a "nocache" option will also become available.

This post was posted by Peachey88 (Flood), but signed as Wikinaut.

Reply to "Local file timestamp?"

Included file doesnt update (solution: new keyword 'nocache')

Peachey88 (Flood) (talkcontribs)

When I include a local file, it only updates when I edit and save page. How can I get it to update by just reloading the page?

This post was posted by Peachey88 (Flood), but signed as

Peachey88 (Flood) (talkcontribs)

This is a limitation of MediaWiki. Note that external content is only refreshed when you save the wiki page that contains the <include/>. Changing the external file WILL NOT update the wiki page until the wiki page is edited and saved (not merely refreshed in the browser). You can also instruct the server to refresh the page by adding the refresh action. See w:en:Wikipedia:Bypass_your_cache#Server_cache . You can add the following to a wiki page to make it easier to clear the cache //www.mediawiki.org/w/index.php?title=Topic:Qbxx7rlqob6nul7m&action=purge

This post was posted by Peachey88 (Flood), but signed as Noahspurrier.

Peachey88 (Flood) (talkcontribs)

At the very end of the module, you could add these lines, which disables page caching when it finds "nocache" keyword as in <include ... nocache />. This will disable the cache for pages that use the include tag.

function ef_include_render( $input, $argv, $parser ) {
    # http://www.mediawiki.org/wiki/Extensions_FAQ#How_do_I_disable_caching_for_pages_using_my_extension.3F
    if ( !empty( $argv['nocache'] ) ) {

    return $output;

Such an option will be part of a new version of the extension. Another possibility is to install MagicNoCache and to add the magic word to your page, or to install one of the alternatives mentioned on bottom of that page.

This post was posted by Peachey88 (Flood), but signed as Wikinaut.

Reply to "Included file doesnt update (solution: new keyword 'nocache')"
Peachey88 (Flood) (talkcontribs)

The previous version of include.php contained a very severe security hole, allowing the inclusion of local files (like /etc/passwd & friends) even in the most paranoid configuration.

I've notified Noah (7 emails sent since july 2010, with different subjects and from different adresses, tried to use the online notification available at http://www.noah.org/cgi-bin/email but it's broken, left a security warning on the home page with a link to my webpage), but I got just one answer asking me to resend my code, which I did, several times. I hate doing this, but I'm hijacking this page to point to my version, to avoid leaving users of this extensions vulnerable to the security hole.

Noah, if you read this and whish to step back in as a maintainer, I'd be glad to let you do so.

This post was posted by Peachey88 (Flood), but signed as MatthieuMoy.

Reply to "Maintainer change"

Conflict with MarkdownExtraGeshiSyntax Extension

Ramalj (talkcontribs)

I'm trying to get Include to work with MarkdownExtraGeshiSyntax so that I can include a markdown file, parse it, and display the formatted version in a Mediawiki article.

Unfortunately, the two extensions don't seem to work together. If I activate them both at the same time, it breaks the Wiki (i.e., pages render blank).

Any idea what the problem could be? The only commonality between the two extensions seems to be that they both set up Geshi-based highlighting.

I'd try a different markdown extension, but this one is the only one that is a) still supported and b) tag-based, so I don't have to switch parsers for the page or the whole site.

Any help would be appreciated.

Note: I also asked on the talk page for MarkdownExtraGeshiSyntax

Reply to "Conflict with MarkdownExtraGeshiSyntax Extension"

Mediawiki magic words inside src-parameter

Expih (talkcontribs)

Is it possible to use Mediawiki magic words like PAGENAME inside the src-parameter? We are having a problem that the magic words aren't processed before the include is processed, which means that our php-page gets parameter PAGENAME instead of the true page name. (talkcontribs)

Yes, I was able to get magicwords to work. For example: <include src="//www.mediawiki.org/w/search/{{#replace:{{#replace:Qtiko7f5vhwhmad4|.pdf|.txt}}||%20}}"/>

Reply to "Mediawiki magic words inside src-parameter"