Extension talk:Include/Archive 1

From mediawiki.org
Latest comment: 13 years ago by DaSch in topic Problem with 1.15


--Pndfam05 22:28, 13 June 2007 (UTC) I tried installing this extension without highlighting and had difficulties on lines 115 and 195. I eliminated the line 115 problem by commenting out line 155, since I didn't want highlighting. I gave up when things crashed at line 195 with the message that the file could not be located. Using Mediawiki v 1.10.0, PHP v5.2.1, MySql v5.0.37Reply[reply]

This has been fixed in the latest version.

Has anybody tried to merge this with the highlighting provided by "SyntaxHighligh_GeSHi"? This is an excellent extension, which, no pun intended, I have extended myself to highglight other languages, and inhouse symbols (from inhouse library). --Cartoro 11:22, 7 September 2007 (UTC)Reply[reply]
If someone wants to send me a patch, I'll merge it into my copy and update it here. Send to noah@noah.org and put "mediawiki" somewhere in the subject. Noahspurrier

Include other formats

Has any thought been given to adapting this extension to import and render a Microsoft Word document. I have very little experience with PHP but would imagine that an addition to the functionality to include other formats would be a neat idea. I may give it a little thought. Prevaljo 18:18, 16 August 2007 (UTC)Reply[reply]

This could be possible if you don't mind converting the Word document to plain text. I could pass a word document through "antiword" and then output the results. You would have to have "antiword" installed. It's common on many Linux distro package repositories. You would loose any embedded graphics and fonts. Email me at noah@noah.org and put the word "mediawiki" somewhere in the subject. Noahspurrier

Include other wiki pages

I want to include parts of Wikipedia articles on my wiki. Can this extension be expanded to do this? If not, is there another extension that can do it? —Eep² 08:16, 20 August 2007 (UTC)Reply[reply]

Did you try Extension:IncludeArticle? --Cartoro 11:22, 7 September 2007 (UTC)Reply[reply]

Isn't there a huge security hole?

Shouldn't you be using escapeshellarg on the src parameter? Installing this and giving it a bad URL with "|| cat /etc/passwd" worked in a way that is very bad...

This has been fixed in the latest version.

Thanks. I feel like a dolt... Noahspurrier

Feature request: Add extraction of specified range of lines only

It would be great to get only specified context of file specified by start and count parameters or even grep search.

Maybe give some examples. This seems like it might be getting too tricky. I can't see that being used a lot, but maybe you have some examples to change my mind. Also show how you would like to see the arguments specified. Noahspurrier

Including wikixml

    if (isset($argv['wikitext']))
        if (isset($argv['wikixml']))
		$begin=stripos($output,'<text xml:space="preserve">')+27;
		$output = substr($output,$begin,-47);
	$parsedText = $parser->parse($output,$parser->mTitle,$parser->mOptions,false,false);	
    $output = $parsedText->getText();

I made small changes for including wiktext from wikixml to a page, unfortunatly it does not work properly. It only works with noesc wikitext wikixml and then such things as <sup>, <ref> and <font ... > are displayed as wikitext, maybe someone an idea how to fix it. because without noesc there is nothing shown at all. Also with nopre. Thanks for helping. DaSch 21:14, 14 January 2008 (UTC)Reply[reply]

Where are you getting you wikixml? It looks like you are trying to strip the xml tags from around the wikitext and then display the wikitext. Is that corrent? I need a little more context to understand what you want. Can you email me a sample of the wikixml that you are trying to include? Include the phrase "mediawiki" in your subject to get around any spam filters and send to noah@noah.org --Noahspurrier 22:31, 16 January 2008 (UTC)Reply[reply]
I'm getting the wikixml from an WikiExport Page. --DaSch 15:25, 19 January 2008 (UTC)Reply[reply]

Include content in my wiki from Wikipedia?

Hi there, I tried your extension with the goal of sucking in content from Wikipedia into my wiki. It sort of worked, but also dragged in extraneous page formatting instead of just the text. Can you please explain how do do what I'd like to accomplish? Thanks for writing the extension!


Try using <include src="LocalSettings.php" /> with this installed. I tried it with my wiki installation (latest official MediaWiki release at time of writing). Great if you don't mind your passwords being revealed! I think there needs to be an option to limit the types of includes permitted - local ones are clearly not safe. 20:28, 7 March 2008 (UTC)Reply[reply]

This has been addressed. I added global config parameters to LocalSettings.php that will limit access. The new version checks two lists -- one list gives allowed directories from which files may be included; the second list stores regular expressions that match files which are DISALLOWED. Obviously, this sort of script has security implications even with these restrictions. I'd be happy if people could point out any other weaknesses. --Noahspurrier 09:10, 6 May 2008 (UTC)Reply[reply]


Useing an <include/> in a template doesn't replace variables. such as:

<include src="http://test.com/{{{file}}}" iframe/>

tries to load {{{file}}} from test.com rather than test.htm

Is something going on in regard to this problem? We really need this feature..., 19 DEC 2008
Many thanks for this extension. I would love to generate Google Charts from data held in wiki pages. 26 JAN 2009
This works - <include src="http://chart.apis.google.com/chart? chs=250x100&chd=t:60,40&cht=p3&chl=Hello|World" iframe="iframe" />
This doesn't <include src="http://chart.apis.google.com/chart?chs=250x100&chd=t:{{:ChartData/HelloWorld}}&cht=p3&chl=Hello|World" iframe="iframe" />

This is a limitation of MediaWiki itself, rather than a bug in the extension - the php code never sees the parameter values, they just don't get parsed. See w:en:Help:Template#When_parameters_do_not_expand for the official advisory. Unfortunately even the #tag trick doesn't work with this one either. I would dearly love to see a neat solution to this, as I also have need of it. Any bright sparks out there got clever ideas? Kenpem 00:36, 4 February 2009 (UTC)Reply[reply]

I have the following (with a customized version of include.php, but see the idea) in a template:

Using templates in tag arguments like <include lines="{{{lines}}}" />
do not work. {{#tag:include }} is just an alternate syntax for
<include />, for which this works. See

some parameters have influence when defined, even with empty value.
We use a variant of the hack described in http://www.mediawiki.org/wiki/Help:Parser_functions_in_templates :
parameter{{{the string XXX in case the parameter isn't provided}}}=...
{{#tag:include |
|style=border: 0px none white}}

Download link?

You must not be aware of how much of a PITA it is to get the source code to this extension onto a remote server. You seriously expect people to copy and paste the extension code? WTF?

There is a download link on the page: Extension:Include#Download Source Code Kenpem 00:39, 4 February 2009 (UTC)Reply[reply]

problem with iframes?

Try following page content

<include iframe src="http://somesite.com/something.htm">

You see category and template and iframe.

<include iframe src="http://somesite.com/something.htm">

You see only iframe, no template or category - any ideas?

solved - it has to be

<include iframe src="http://somesite.com/something.htm" />

MediaWiki 1.13.5, PHP 5.2.8

Problem with 1.15

The option wikitext does not work in 1.15alpha, there is nothing given back. --DaSch 16:20, 28 March 2009 (UTC)Reply[reply]

Another Problem is that UTF-8 is broken so the page includes is displayed in wrong Charset. --DaSch 20:10, 28 March 2009 (UTC)Reply[reply]