Revision [8258]

This is an old revision of SpectreMoo made by SpectreMoo on 2005-05-17 19:28:40.

 

SpectreMoo


Other Interests:
Biologically inspired computing (GP, NNs, etc.)
Astronomy; mostly reading, I'm no amateur astronomer
Physics
Wikka's only one year old? It feels so much more mature! Congratulations!

I've installed Wikka to augment our company intranet, and in the process I've made a number of both superficial and functional changes to the code which I plan on posting here when I get the chance.

The biggest enhancement request I've got so far is page anchors; other wikis typically impement them as Wikka Action type things, but ideally each header (e.g., ===Foo===) would become an automatic page anchor. I've implemented markup to add anchors (using {# and #} around an anchor name) which works, but adding it to the headers shouldn't be too difficult. I've already got the $wikka->Link method modified to accept anchor targets in the links.

(Then again, I see now that DotMG has already contributed an AnchorAction... so much for my work! <grin>)
(Ah ha! TableofcontentsAction has copious amounts of information as well.)

PHP isn't my first language (Java is), but with Wikka's structure, that's not an issue; it's quite easy to modify and expand.

Thank you!



I'm going to post some of the hacks I've created here, maybe others will find them useful. Many of the hacks I've written work only within my company intranet environment (auto-linking of java class names to our javadocs, for instance), but anything that's more generally applicable I'll try to post here.

First off: the latest iteration of my {{fortune}} action:

<?php

    $location = "SOME DEFAULT";    // for example: http://www.textfiles.com/humor/TAGLINES/random.txt

    if (!$vars["location"])
    {
            $lines = file ($location);
    }  
    else
    {
        $location = $vars["location"];

        if ("http" == substr ($location, 0, 4))
        {
            $lines = file ($location);
        }
        else if ($this->IsWikiName ($location))
        {
            if (!$this->ExistsPage ($location))
            {
                echo "<em>The specified page does not exist.</em>";
                return;
            }

            $page = $this->LoadPage ($location);
            if ($page)
            {
                $line = 0;
                $pagelines = explode ("\n", $page["body"]);

                for ($i = 0; $i < count ($pagelines); $i++)
                {
                    if (preg_match ("/[ ~]*-(.*)/",$pagelines[$i],$matches))
                    {
                        $lines[$line++] = $matches[1];
                    }
                }
            }
        }

    }
       
    echo $lines[array_rand ($lines)];
?>


To use, save as fortune.php in the actions directory.

Usage: {{fortune location="URL|WikiPage"}}



CategoryUsers
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki