Revision [21711]

This is an old revision of wackozacko made by wackozacko on 2012-04-28 13:36:15.

 

Just thought I'd create a page I could link to. Don't really have anything to put here, but if I become part of the community at least I'll have a placeholder I can then add to.

Scripts


Allow Comments

A very simple script that changes my default setting on specific pages to allow comments and displays a little notice saying so.

<?php
    echo $this->Format('>>@@//THIS PAGE ALLOWS COMMENTS//@@>>');
    $this->config["hide_comments"] = 0;
?>


List of Pages in Category

Created a little script that adds an unordered list of pages belonging to a specified category to a page. It's turned out to be pretty useful. I've got one page which just lists all the pages on my site in a table format by category, and it automatically updates.

<?php
/**
 * Creates a plain list of the pages in a specified category.
 *
 * Modified from the WikkaWiki file category.php
 *
 * @package Actions
 * @version     $1.0$
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
 *
 * @author  {@link http://wikkawiki.org/wackozacko Isaac Doub}
 * @input   string $category optional: the category from which you want to display the list of pages. Default: current page
 * @output  a list of pages in a category
 * @uses    Wakka::GetPageTag();
 * @uses    Wakka::FullCategoryTextSearch()
 * @uses    Wakka::FullTextSearch()
 */

 
if ($cattag = $_GET['wakka'])   #312 (only files action uses POST for wakka)
{
    $str ="";
    if (!isset($category)) $category=$this->GetPageTag();
    if ($category=="/") $category="CategoryCategory";

    if (isset($class)) {
        $class="class=\"$class\"";
    } else {
        $class="";
    }
   
    if (!$category) {$category=$cattag;}

    if ($this->CheckMySQLVersion(4,0,1))
    {
        $results = $this->FullCategoryTextSearch($category);
    }
    else
    {
        $utf8Compatible = 0;
        if(1 == $this->config['utf8_compat_search']) {
            $utf8Compatible = 1;
        }
       
            $results = $this->FullTextSearch($category, 0, $utf8Compatible);
    }

    if ($results)
    {      
        $count = 0;
        $categorycount = 0;
        $list = array();
       
        foreach ($results as $i => $cpage) {
            if($cpage['tag'] != $category) {
                array_push($list,$cpage['tag']);
            }
        }
       
        sort($list);
       
        while (list($key, $val) = each($list)) {
            if ($val != $this->GetPageTag()) {
                $str .= "~-[[".$val."]]\n";
                $count++;
                $categorycount++;
            }
        }
    }
    else $str .= sprintf(T_("Sorry, No items found for %s"),$category);
   
    echo $this->Format($str);
}
?>
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki