Hi Manuela,
please have a look at "Extension:PageForms" [1]. Maybe it already provides the functionality you need.
Looks like in your first example the second parameter to "doEditContent" should be $pageContentText (type string) and not $pageContent (type WikitextContent). I think "doCreate" is not necessary.
If this does not work, can you please share the excalt error message?
[1] https://www.mediawiki.org/wiki/Extension:Page_Forms
--
Robert
________________________________ Von: MediaWiki-l mediawiki-l-bounces@lists.wikimedia.org im Auftrag von Manuela pressephotografin@gmail.com Gesendet: Montag, 28. Januar 2019 07:06 An: mediawiki-l@lists.wikimedia.org Betreff: [MediaWiki-l] Extension which creates a Wikipage with content
Hi alltogether, I hope this is the correct mailing list, please excuse if it is not (and excuse my English, please).
I run a private Wiki and I am trying to create an extension where the user can enter the title and some content in a form, similar to the extension InputBox https://www.mediawiki.org/wiki/Extension:InputBox (you cannot enter page content into the form created by this extension). I studied the code of several extensions and created something like this:
#*** begin code *** $pageTitleText = "my new wikipage"; $pageTitle = Title::newFromText( $pageTitleText ); $pageContentText = "my new page content"; $pageContent = new WikitextContent( $pageContentText ); $newWikiPage->doEditContent( $pageContent, $pageContent, EDIT_NEW ); #*** end code ***
Actually this is not working and creates an internal error. I tried something different
#*** begin code *** #... $me = User::newFromSession(); $newWikiPage->doCreate($pageContent,EDIT_NEW,$me,"summary",array()); #*** end code ***
This code creates an internal error, too. array() should be an array with meta-information which I could not figure out until now. I have studied the internal documentian https://doc.wikimedia.org/mediawiki-core/REL1_31/php/ and the code of several exentions, and now I am lost in classes and PHP-Code, maybe someone can help me out? Thank you for reading this, Manuela
-- Sent from: http://mediawiki-i.429.n8.nabble.com/
_______________________________________________ MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l