Revision history for RichardTerry
Additions:
=====Richard Terry=====
I used to have a blog action here, but it's outdated and doesn't work with current versions of Wikka.
I used to have a blog action here, but it's outdated and doesn't work with current versions of Wikka.
Deletions:
I created a very simple Blog Action for my personal website. To insert a Blog on a page, I insert {{blog name="//""EntryListPage""//"} where //""EntryListPage""// is a page containing A list of pages. Each wiki page on the entry page is included as an entry in the Blog. To edit an entry, you simply edit the page that corresponds to the entry.
I thought about making ""EntryListPage"" a Category, but I didn't want the Category wikiname appearing in the entries.
I also tried marking a page as a Blog entry if it's wikiname began with **Blog**. That restricted me to only one blog per wiki, though.
Maybe someone will find this useful. (Or maybe someone will find a better way to do it. Either way...) 8^)
**Here is actions/blog.php:**
%%(php)
<?php
if (!isset($name))
{
print "<span class='error'>You need to include \"name=\" when using the blog action.</span>";
}
else if ($pages = $this->LoadBlogEntries($name))
{
$curday = "";
if ($user = $this->GetUser()) {
$max = $user["changescount"];
} else {
$max = 50;
}
foreach ($pages as $i => $page)
{
if (($i < $max) || !$max)
{
// day header
list($day, $time) = explode(" ", $page["firsttime"]);
if ($day != $curday)
{
if ($curday) print("</span><br />\n");
print("<strong>$day:</strong><br />\n<span class=\"recentchanges\">");
$curday = $day;
}
// Begin entry
$pagetag = $page["tag"];
// Print Title. Strip "Blog" from page tag and add spaces.
print "<h1>".$this->BeautifyTitle($pagetag)."</h1><br />\n";
// I used Dreck Fehler's include action code here.
$pagename = strtolower($pagetag);
if (!$this->config["includes"]) $this->config["includes"][] = strtolower($this->tag);
if (!in_array($pagename, $this->config["includes"]) && $pagename != $this->tag) {
if ($this->HasAccess("read", $pagename)) {
$this->config["includes"][] = $pagename;
$blogpage = $this->LoadPage($pagename);
print $this->Format($blogpage["body"]);
}
} else print "<span class='error'>Circular reference detected</span>";
}
print "<br /><br />\n";
}
}
?>
%%
**Here are the additions I made to wikka.php:**
%%(php)<?php
function LoadPagesLinkingFrom($tag) { return $this->LoadAll("select to_tag as tag from ".$this->config["table_prefix"]."links where from_tag = '".mysql_real_escape_string($tag)."' order by tag"); }
function LoadBlogEntries($tag)
{
//Get pages linking to Blog entry list page and form part of query string
$blogPages = $this->LoadPagesLinkingFrom($tag);
if (count($blogPages) == 0)
{
return false;
}
$i = 0;
$queryString = "";
foreach ($blogPages as $blogPage)
{
$i++;
if ($i < count($blogPages))
{
$queryString .= "\"".$blogPage["tag"]."\", ";
}
else
{
$queryString .= "\"".$blogPage["tag"]."\"";
}
}
if ($pages = $this->LoadAll("select min(entry2.id) as firstid, min(entry2.time) as firsttime, entry1.* from ".$this->config["table_prefix"]."pages entry1, ".$this->config["table_prefix"]."pages entry2 where entry1.tag = entry2.tag and entry1.tag in (".$queryString.") and entry1.latest ='Y' group by entry1.tag order by firstid desc"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
function BeautifyTitle($title)
{
/*
* I scarfed this function from John Greenway's JSPWiki page
* http://www.jspwiki.org/Wiki.jsp?page=JohnGreenaway
*/
$result = "";
for($i = 0; $i <= strlen($title); $i++)
{
if(ctype_upper($title[$i]) && ($i > 0))
{
if (($i < (strlen($title) - 1) && ctype_lower($title[$i+1])) || ctype_lower($title[$i-1])) {
$result.=' ';
}
}
$result.= $title[$i];
}
return $result;
}
?>%%
Revision [18179]
Edited on 2008-01-28 00:10:27 by RichardTerry [Modified links pointing to docs server]No Differences
Additions:
%%(php)<?php
?>%%
?>%%
Deletions:
Additions:
I created a very simple Blog Action for my personal website. To insert a Blog on a page, I insert {{blog name="//""EntryListPage""//"} where //""EntryListPage""// is a page containing A list of pages. Each wiki page on the entry page is included as an entry in the Blog. To edit an entry, you simply edit the page that corresponds to the entry.
I thought about making ""EntryListPage"" a Category, but I didn't want the Category wikiname appearing in the entries.
I also tried marking a page as a Blog entry if it's wikiname began with **Blog**. That restricted me to only one blog per wiki, though.
Maybe someone will find this useful. (Or maybe someone will find a better way to do it. Either way...) 8^)
**Here are the additions I made to wikka.php:**
I thought about making ""EntryListPage"" a Category, but I didn't want the Category wikiname appearing in the entries.
I also tried marking a page as a Blog entry if it's wikiname began with **Blog**. That restricted me to only one blog per wiki, though.
Maybe someone will find this useful. (Or maybe someone will find a better way to do it. Either way...) 8^)
**Here are the additions I made to wikka.php:**
Deletions:
**Here are the changes I made to wikka.php:**
Additions:
=====Richard Terry=====
I created a very simple Blog Action for my personal website.
**Here is actions/blog.php:**
%%(php)
<?php
if (!isset($name))
{
print "<span class='error'>You need to include \"name=\" when using the blog action.</span>";
}
else if ($pages = $this->LoadBlogEntries($name))
{
$curday = "";
if ($user = $this->GetUser()) {
$max = $user["changescount"];
} else {
$max = 50;
}
foreach ($pages as $i => $page)
{
if (($i < $max) || !$max)
{
// day header
list($day, $time) = explode(" ", $page["firsttime"]);
if ($day != $curday)
{
if ($curday) print("</span><br />\n");
print("<strong>$day:</strong><br />\n<span class=\"recentchanges\">");
$curday = $day;
}
// Begin entry
$pagetag = $page["tag"];
// Print Title. Strip "Blog" from page tag and add spaces.
print "<h1>".$this->BeautifyTitle($pagetag)."</h1><br />\n";
// I used Dreck Fehler's include action code here.
$pagename = strtolower($pagetag);
if (!$this->config["includes"]) $this->config["includes"][] = strtolower($this->tag);
if (!in_array($pagename, $this->config["includes"]) && $pagename != $this->tag) {
if ($this->HasAccess("read", $pagename)) {
$this->config["includes"][] = $pagename;
$blogpage = $this->LoadPage($pagename);
print $this->Format($blogpage["body"]);
}
} else print "<span class='error'>Circular reference detected</span>";
}
print "<br /><br />\n";
}
}
?>
%%
**Here are the changes I made to wikka.php:**
%%
function LoadPagesLinkingFrom($tag) { return $this->LoadAll("select to_tag as tag from ".$this->config["table_prefix"]."links where from_tag = '".mysql_real_escape_string($tag)."' order by tag"); }
function LoadBlogEntries($tag)
{
//Get pages linking to Blog entry list page and form part of query string
$blogPages = $this->LoadPagesLinkingFrom($tag);
if (count($blogPages) == 0)
{
return false;
}
$i = 0;
$queryString = "";
foreach ($blogPages as $blogPage)
{
$i++;
if ($i < count($blogPages))
{
$queryString .= "\"".$blogPage["tag"]."\", ";
}
else
{
$queryString .= "\"".$blogPage["tag"]."\"";
}
}
if ($pages = $this->LoadAll("select min(entry2.id) as firstid, min(entry2.time) as firsttime, entry1.* from ".$this->config["table_prefix"]."pages entry1, ".$this->config["table_prefix"]."pages entry2 where entry1.tag = entry2.tag and entry1.tag in (".$queryString.") and entry1.latest ='Y' group by entry1.tag order by firstid desc"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
function BeautifyTitle($title)
{
/*
* I scarfed this function from John Greenway's JSPWiki page
* http://www.jspwiki.org/Wiki.jsp?page=JohnGreenaway
*/
$result = "";
for($i = 0; $i <= strlen($title); $i++)
{
if(ctype_upper($title[$i]) && ($i > 0))
{
if (($i < (strlen($title) - 1) && ctype_lower($title[$i+1])) || ctype_lower($title[$i-1])) {
$result.=' ';
}
}
$result.= $title[$i];
}
return $result;
}
%%
I created a very simple Blog Action for my personal website.
**Here is actions/blog.php:**
%%(php)
<?php
if (!isset($name))
{
print "<span class='error'>You need to include \"name=\" when using the blog action.</span>";
}
else if ($pages = $this->LoadBlogEntries($name))
{
$curday = "";
if ($user = $this->GetUser()) {
$max = $user["changescount"];
} else {
$max = 50;
}
foreach ($pages as $i => $page)
{
if (($i < $max) || !$max)
{
// day header
list($day, $time) = explode(" ", $page["firsttime"]);
if ($day != $curday)
{
if ($curday) print("</span><br />\n");
print("<strong>$day:</strong><br />\n<span class=\"recentchanges\">");
$curday = $day;
}
// Begin entry
$pagetag = $page["tag"];
// Print Title. Strip "Blog" from page tag and add spaces.
print "<h1>".$this->BeautifyTitle($pagetag)."</h1><br />\n";
// I used Dreck Fehler's include action code here.
$pagename = strtolower($pagetag);
if (!$this->config["includes"]) $this->config["includes"][] = strtolower($this->tag);
if (!in_array($pagename, $this->config["includes"]) && $pagename != $this->tag) {
if ($this->HasAccess("read", $pagename)) {
$this->config["includes"][] = $pagename;
$blogpage = $this->LoadPage($pagename);
print $this->Format($blogpage["body"]);
}
} else print "<span class='error'>Circular reference detected</span>";
}
print "<br /><br />\n";
}
}
?>
%%
**Here are the changes I made to wikka.php:**
%%
function LoadPagesLinkingFrom($tag) { return $this->LoadAll("select to_tag as tag from ".$this->config["table_prefix"]."links where from_tag = '".mysql_real_escape_string($tag)."' order by tag"); }
function LoadBlogEntries($tag)
{
//Get pages linking to Blog entry list page and form part of query string
$blogPages = $this->LoadPagesLinkingFrom($tag);
if (count($blogPages) == 0)
{
return false;
}
$i = 0;
$queryString = "";
foreach ($blogPages as $blogPage)
{
$i++;
if ($i < count($blogPages))
{
$queryString .= "\"".$blogPage["tag"]."\", ";
}
else
{
$queryString .= "\"".$blogPage["tag"]."\"";
}
}
if ($pages = $this->LoadAll("select min(entry2.id) as firstid, min(entry2.time) as firsttime, entry1.* from ".$this->config["table_prefix"]."pages entry1, ".$this->config["table_prefix"]."pages entry2 where entry1.tag = entry2.tag and entry1.tag in (".$queryString.") and entry1.latest ='Y' group by entry1.tag order by firstid desc"))
{
foreach ($pages as $page)
{
$this->CachePage($page);
}
return $pages;
}
}
function BeautifyTitle($title)
{
/*
* I scarfed this function from John Greenway's JSPWiki page
* http://www.jspwiki.org/Wiki.jsp?page=JohnGreenaway
*/
$result = "";
for($i = 0; $i <= strlen($title); $i++)
{
if(ctype_upper($title[$i]) && ($i > 0))
{
if (($i < (strlen($title) - 1) && ctype_lower($title[$i+1])) || ctype_lower($title[$i-1])) {
$result.=' ';
}
}
$result.= $title[$i];
}
return $result;
}
%%
Deletions:
ConfigurationOptions
ActionInfo
FormatterInfo
HandlerInfo
PageCreationInfo
EditPageInfo
AccessControlInfo
PageDeletionInfo
AdministrationInfo
//Richard: the ConfigurationOptions page looks like a great start. **Thank you!** - JsnX//
Additions:
PageCreationInfo
EditPageInfo
AccessControlInfo
PageDeletionInfo
AdministrationInfo
EditPageInfo
AccessControlInfo
PageDeletionInfo
AdministrationInfo
Additions:
FormatterInfo
HandlerInfo
HandlerInfo
Additions:
ActionInfo
Additions:
//Richard: the ConfigurationOptions page looks like a great start. **Thank you!** - JsnX//