Loading...
 
Features / Usability

Features / Usability


Programmatic access TikiWiki

posts: 6

Is there a way to write external scripts that can access content entered to the Wiki?

For example, it would be nice to be able to write a script that gets a list of all Wiki pages, or a list of Wiki pages in some structure, and then retrieves the contents of pages one by one, either in text, or on HTML format, and does some processing over the pages.

Is it possible to do this?

posts: 6

OK, I honestly tried understand material at these links but failed. :-(

Lets look at it from another angle.

Is the MySQL database structure of tiki database stable enough so that I can extract Wiki content directly from the database? I looked at the tables created by TikiWiki, looks like I can get wiki page contents from table 'tiki_pages', column 'data', and 'is_html' column says if the 'data' contains html or wiki-formatted text. Also, I can get structures hierarchy form 'tiki_structures' table.

Is this stable enough so that I could write scripts that will not require complete rewrite with every TikiWiki version?

And, if I get from the database page text that is wiki-formatted, how do I parse/convert it into html (or, at least, into plain text?) There should be some PHP function somewhere that does this...

posts: 3623 United States

If all you want to know is if you can grab the wiki page content from the MySQL database, then yes... this is quite easy. Simply use the data row from the tiki-pages table.

If you're also wanting functions to render the wiki markup as HTML, look at some of the functions in ../lib/wiki/wikilib.php as a start. But you're going to need lots more, since the wiki syntax may include plugins that do all sorts of stuff (such as permission checks, custom rendering, etc.)

Just curious... what is your use case?

HTH,

- Rick | My Tiki Blog | My Tiki UserPage

Why be a dummy? Get smarty! TikiForSmarties.com
Tiki for Smarties, your source for the best (and only) Tiki books, guides, and tutorials.
posts: 6

User case: For example, you could write a book using TikiWiki. Writing book is hard and boring (when it is not exciting :-) ), so you need constant motivation. A script could be runnung as cron job, that every night grabs a set of pages from a TikiWiki sturcture, calculates this day word count, and compares with yesterdays word count. Then it sends you an email: You moron, you wrote only 150 words yesterday!

Also, I'm pretty sure many people would find a lots of usefullness in a programmatic access to the contents of Tiki's wiki pages, blogs, forums - not only trackers that already put form contents into the database. It would be nice to have wiki contents exposed as, say REST web service through URLs like this:

http://example.com/tiki/rest/wiki/pages/PageName?format=plaintext

or

http://example.com/tiki/rest/wiki/structures/StructureName/child/3/child/2?query=GetPageName


posts: 255 United States

You asked if it was possible -not if it was advisable.

Marc certainly knows terabytes more than I do for sure, but it would seem quite possible since Tiki is based on MySQL. Php/MySQl code could be written to extract data from Tiki.

Again, I don't know if this is a dangerous idea or not.