[Mediawiki-l] Extension pdfbook problem

Günter Gratzer Guenter.Gratzer at abf.co.at
Fri Mar 28 11:19:07 UTC 2008


Hi,
I found the error in pdfbook.php. If [{{fullurl:{{FULLPAGENAMEE}}|action=pdfbook}}  was used the $articles was empty and so no text from the page was copied to html file.
To correct it you have to enter the follwing line in the else block of    if ($title->getNamespace() == NS_CATEGORY) {

$articles[] = $title;
 
so the new code looks like this
 
   if ($title->getNamespace() == NS_CATEGORY) {
    $cat    = $title->getDBkey();
    $db     = &wfGetDB(DB_SLAVE);
    $cl     = $db->tableName('categorylinks');
    $result = $db->query("SELECT cl_from FROM $cl WHERE cl_to = '$cat' ORDER BY cl_sortkey");
    if ($result instanceof ResultWrapper) $result = $result->result;
    while ($row = $db->fetchRow($result)) $articles[] = Title::newFromID($row[0]);
    }
   else {
    $text = $article->fetchContent();
    $text = $wgParser->preprocess($text,$title,$opt);
    if (preg_match_all('/^\\*\\s*\\[{2}\\s*([^\\|\\]]+)\\s*.*?\\]{2}/m',$text,$links))
     foreach ($links[1] as $link) $articles[] = Title::newFromText($link);
    $articles[] = $title;
    }

I'm not an export in php and wiki programming. To all experts please check if I did it right
 
Günter
 

________________________________

Von: mediawiki-l-bounces at lists.wikimedia.org im Auftrag von Günter Gratzer
Gesendet: Do 27.03.2008 14:23
An: mediawiki-l at lists.wikimedia.org
Betreff: [Mediawiki-l] Extension pdfbook problem



Hi,
anyone tried
[{{fullurl:{{FULLPAGENAMEE}}|action=pdfbook}} download this selection of articles as a PDF book]
in a wiki page to generate a PDF from an article? I don't get it work. The temporary HTML file is always empty.

If I enter a URL like this
http://www.foo.bar/wiki/index.php?title=Category:Foo&action=pdfbook <http://www.foo.bar/wiki/index.php?title=Category:Foo&action=pdfbook>
a pdf file will be generated. With title it doesn't.

I'm using Media Wiki 1.11.0, Pdf Book 0.0.9, HTMLDOC 1.8.27


Günter

_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l




More information about the MediaWiki-l mailing list