Revision history for RichardTerry


Revision [19626]

Last edited on 2008-03-04 17:38:23 by 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.
Deletions:
=====Richard Terry=====

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

Revision [1112]

Edited on 2004-09-03 03:02:57 by RichardTerry [Blog Action.]
Additions:
%%(php)<?php
?>%%
Deletions:
%%


Revision [1109]

Edited on 2004-09-03 02:50:54 by RichardTerry [Added a bit more description.]
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:**
Deletions:
I created a very simple Blog Action for my personal website.
**Here are the changes I made to wikka.php:**


Revision [1108]

Edited on 2004-09-03 02:39:34 by RichardTerry [Added a bit more description.]
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;
}
%%
Deletions:
=====Richard Terry=====

ConfigurationOptions

ActionInfo
FormatterInfo
HandlerInfo
PageCreationInfo
EditPageInfo
AccessControlInfo
PageDeletionInfo
AdministrationInfo

//Richard: the ConfigurationOptions page looks like a great start. **Thank you!** - JsnX//


Revision [387]

Edited on 2004-05-26 00:38:05 by RichardTerry [Added a bit more description.]
Additions:
PageCreationInfo
EditPageInfo
AccessControlInfo
PageDeletionInfo
AdministrationInfo


Revision [343]

Edited on 2004-05-23 01:53:13 by RichardTerry [Added a bit more description.]
Additions:
FormatterInfo
HandlerInfo


Revision [342]

Edited on 2004-05-23 01:43:01 by RichardTerry [Added a bit more description.]
Additions:
ActionInfo


Revision [335]

Edited on 2004-05-20 02:58:33 by JsnX [Comment to Richard]
Additions:
//Richard: the ConfigurationOptions page looks like a great start. **Thank you!** - JsnX//


Revision [324]

The oldest known version of this page was created on 2004-05-19 02:17:50 by RichardTerry [Comment to Richard]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki