Extension talk:IncludeArticle

anyone will update parser of this extension?
many articles are crashed because i use including quite often...

Download Link Broken
It appears to be trying to execute the php file rather than serve it up statically. --Jimbojw 17:44, 5 April 2007 (UTC)

Downloadlink
Please use right click - save as ... to download the php-file.

definitely a problem
i am having issues saving as myself. perhaps copy the code onto the wiki?

dynamic content update
It would be nice to have a dynamic content update. Is this possible?

Category pages broken??
Trying to use specified include pages that are categories, but this extrnsion does not seem to work :-(

I am using this code:

  

IncludeArticle - substr
I would like to retrieve a segment of an article delimited with stringSTART and stringEND.

For example 

I've included the following snipet..

if( isset( $argv["stringSTART"] ) AND isset( $argv["stringEND"] ) ) { $articlestart = strpos( $text, $argv["stringSTART"] ); $articleend = strpos( $text, $argv["stringEND"] ) - $articlestart; $argv["lines"] = false; } # end string delimited sub string specification

but can't get the stringSTART stringEND argv variables passed. What's the trick?

jtg

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² 07:59, 20 August 2007 (UTC)
 * Did you try: Extension:Include --76.27.82.88 06:59, 23 September 2007 (UTC)

Included edit links don't work
My experience is that if you use this to include another article and that article has sections in it, the edit links will display to users but they don't work correctly when someone clicks on them. FYI. --76.27.82.88 07:01, 23 September 2007 (UTC)

Default to include the entire article
I wanted IncludeArticle to default to include the entire article instead of the first 200 characters. In fact, there is no way to get the entire article unless you specify a sufficiently large count for each article individually.

I made the following change, which sets the default count to include the entire article, and also allows you to specify start.

Brion.finlay 21:02, 13 October 2007 (UTC)

Filter to demote headers
I would like a filter that demotes all headers when including an article, and the ability to construct a master table of content for an article built up of included articlesBrion.finlay 21:02, 13 October 2007 (UTC)
 * Definitely agreed. --129.21.254.209 13:58, 9 March 2009 (UTC)

Include content from Wikipedia into my wiki?
Hi there, your extension is perfect except it works only in my wiki's main namespace. Can you explain how your extension might work to include content from Wikipedia (or any other external source housed in a MediaWiki-based site? Fingers crossed...  Thanks for writing the extension!

Not yet compatible with 1.12 (new parser)
I was only able to get IncludeArticle.php to work with 1.12 by reverting back to the older parser, with this code in LocalSettings.php: $wgParserConf = array( 'class' => 'Parser_OldPP' );

I emailed the Extension author requesting coding changes to be compatible with the new parser. --12.187.196.130 11:56, 25 May 2008 (UTC)

Modifications to accomodate subpages, break on white space character, and linked ellipsis
Here is code for IncludeArticle.php with the following modifications:
 * Accomodates subpages, which show up in the page name after a slash character "/". Works for any number of levels of subpages
 * When the include limit is by number of characters, the limit is increased until the first white space character is found. This avoids breaking words in the middle, but does not prevent wiki text from being partially rendered.
 * Adds a hyperlinked ellipsis, which defaults to "<...more>" in the global variable $wgEllipsis. This link is appended to the end of the included text to make it easy for the reader to go to the included page to read the full text.

I use this functionality to include short exerpts from subpages on a main page, i.e. when the main page is a book review and the subpages are highlights and commentaries on specific sections in the book.

By using subpages, I can add semantic annotations to each one, while still aggregating them into sections on the main page (the book review).

'''This code is still not compatible with the new parser in 1.12. I hope the orgininal developer or someone else can make this change.'''

--Russell.thomas 18:39, 5 June 2008 (UTC)

"Section" option code patch
The following patch enable the use of the "section" option, that only include a specific subsection of an article. (Sections are defined by header levels)

Use example :



--- IncludeArticle.php	2008-09-26 14:31:08.000000000 +0200 +++ IncludeArticle.php.orig	2008-09-26 14:22:04.000000000 +0200 @@ -48,21 +48,6 @@           $text = ''; }    } -    if (isset($argv["section"])) -   { -    	$section = $argv["section"]; -	$TitleSection = "/".$section; -   	// from section start to next section (same level) start -	$match1='#(=+)\s*'.$section.'\s*\1\n*(.*)[^=]\1[^=]#Usi'; -	// from section start to text end -	//$match2='#(=+)\s*'.$section.'\s*\1\n*(.*)\z#si'; -	$match2='#(=+)\s*'.$section.'\s*\1\n*(.*)\z#si'; -	preg_match($match1,$text,$matches); -	if (isset($matches[1])) { -		if ($matches[1] == "=") preg_match($match2,$text,$matches); -	} -	if (isset($matches[2])) $text=$matches[2]; -   }     if ($argv["lines"]==false) {        $text = substr($text, $articlestart, $articleend); @@ -91,14 +76,11 @@    }     $newvariables["title"]=$aTitlecomp; $newvariables["titleblank"]=$aTitleblank; -   $newvariables["content"]="\n".$text; +   $newvariables["content"]=$text; $variables = $parser->replaceVariables( $input, $newvariables ); $output = $parser->parse( $variables, $parser->mTitle, $parser->mOptions, true, false ); $inhalt = $output->getText; $html=$inhalt; -   $html="".$html."Included article \"".$aTitlecomp.$TitleSection."\"  "; -    return $html; }

How to use the patch above
I am very interested in the "section" option enabled by the patch above, but I don't know how to use it or how can I modify the IncludeArticle code. Pls help. Moreover, how can I disable the "table of contents" in the included article. Thx!

To disable TOC enter anywhere on the page.

To use the extension open IncludeArticle and find the text "if ($argv["lines"]==false)" It should be around Line 55. Then enter everything that is preceded with a '-'. Delete the '-' and save the extension.

Strange problem after upgrading to the last version of Mediawiki
If I enable this extension, I get this error message: Fatal error: Call to a member function getPrefixedDBkey on a non-object in includes/parser/Preprocessor_DOM.php on line 996

Die Klasse 'Parser_OldPP' wurde mit Mediawiki Version 1.14 entfernt.

I've also tried inserting: $wgParserConf = array ('class'=>'Parser_OldPP');

How can I solve it?

template processing
A tip that would've saved me a lot of head-pounding today: Templates in the included article are not processed until after they are added to the current article. So if you try to hack this extension to do a preg_replace on a regex that's generated by a transcluded template... it won't work.

Download Broken?
I tried doing the right-click thing and then save as for the PHP file, but I get served up the executed error of the PHP script. Can you post the code on the wiki page or package it into a ZIP?