How to add your own 'feature' in Wikka? (by example)

The goal of this page is to give you an overview. For more detailed information please visit one of the related pages...

Add the (html)code within double-double-quotes

""<span style="color: #FF0000">Hello World!</span>""


Add the (html)code into an action

<span style="color: #FF0000">
Hello World!
</span>

<?php
    print "<span style=\"color: #FF0000\">";
    print "Hello World!";
    print "</span>\n";
?>



Make two actions x_start and x_stop

{{red_start}}Hello World!{{red_stop}}
<span style="color: #FF0000">

</span>



Make an action and use the variable $wikka_vars

{{red start}}Hello World!{{red stop}}
<?php
if(isset($wikka_vars) AND $wikka_vars<>""){
        switch($wikka_vars){
            case "start": print "<span style=\"color: #FF0000\">"; break;
            case "stop": print "</span>"; break;
        }
}
?>

{{red Hello World!}}
<?php
        print "<span style=\"color: #FF0000\">";
        print $wikka_vars;
        print "</span>\n";
?>

So the second "print" line will become: print $this->Format( $wikka_vars );


Make an action and use the array $vars

{{red color="#FF0000" string="Hello World!"}}
<?php
if ( isset($vars["color"]) AND $vars["color"]<>"" ){ $c = $vars["color"]; }else{ $c="#999999"; }
        print "<span style=\"color: ". $c ."\">";
        print $this->Format( $wikka_vars );
        print "</span>\n";
?>



Make a formatter

%%(red)First line
Second line
Last Line%%
<?php
        print "<span style=\"color: #FF0000\">";
        print $this->Format( $text );
        print "</span>\n";
?>



Make an handler

<?php
if ($this->HasAccess("read") && $this->page)
{
        // display raw page
        print($this->page["body"]);
}
?>



Change the code / add a new pattern

"rfc\d{1,4}|RFC\d{1,4}|".

else if(preg_match("/(rfc(\d+))/i", $thing, $matches) )
{
    return $wakka->Link("http://www.faqs.org/rfcs/rfc".$matches[2].".html","",$matches[1]);
}




And now something completely different... Security


I hope this has triggered your creative brain and I look forward to reading your code on this site...
If your stuck with some code, considder posting it in ProgrammingHelp.

Category Howto | Category User Contributions | Category Development
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki