Hi developers, SMW 1.3, to be released this weekend, will include minor changes that affect people developing result formats for SMW (query printer classes). Some things get simpler, but most people will require only very minor changes.
Developing query printers basically means to implement the method getResultText(). This method gets a set of results and an outputmode (wiki, html, file?). So far, query printers needed to respect the output mode, delivering results in the required format (e.g. ready to use in HTML). This is no longer the case: essentially it is enough if a printer always creates wiki text (note that this may mean that you have to use SMW_OUTPUT_WIKI instead of $outputformat in some of your function calls). This is also the suggested procedure: do not create HTML if you can do it in wiki. This will make query results appear in a more uniform way (with wiki-markup in property values supported everywhere), and simplify your code. If a printer still has created HTML output (no matter which outputmode it was in), then it must now set "$this->isHTML = true;". This is useful if you explicitly need to use HTML output, e.g. since you cannot achieve certain formatting in wiki text. As I said, this works for all output modes. On the other hand, you can also return wiki text in all cases and do nothing else. Only if you generate wiki text that includes templates ({{...}}) or template-like stuff such as parser functions, then you need to set "$this->hasTemplates = true;" This will take care of the templates and the issues arising around recursive #ask calls. You do not have to use an own parser object to expand/pre-process templates any more. In addition, your code no longer needs to take care of the parameter $this->mIntro (if you did not, then it will now work; if you did, remove it). The parent class will add the intro-parameter if needed. Finally, it is recommended to not access the parameter $this->mSearchlabel any more. There are functions $this->getSearchLabel($outputformat) and $this->linkFurtherResults($results) that can be used to get the (HTML-safe if needed) label and to check if a further results link should be created at all. Feel free to ask if you have questions, or have a look at the QP-files in SVN for examples. Cheers, Markus -- Markus Krötzsch Semantic MediaWiki http://semantic-mediawiki.org http://korrekt.org [EMAIL PROTECTED]
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel