[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[emacs-wiki-discuss] Blog comments are surprisingly easy to hack in =)
From: |
Sacha Chua |
Subject: |
[emacs-wiki-discuss] Blog comments are surprisingly easy to hack in =) |
Date: |
Wed, 21 Sep 2005 00:59:01 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
Hello, everyone!
One look at Planner's history will show you that I take an
extraordinarily long time to figure out things that should be common
sense. It took me months to figure out how annotations should work,
for example. <laugh>
Today's marvelous, life-changing discovery: comments!
I finally got around to adding a _real_ commenting system to my blog
after receiving so many helpful tips on everything from networking to
breathing, and after suffering a case of comment envy reading a
friend's blog.
It was amazingly simple. I originally went with Haloscan, but a little
bit of Googling turned up this great little system called Blogkomm
(http://www.blogkomm.com), which I like very much.
It's PHP, so it was really easy to drop into my config. It's
filebased, so I can set up my scripts to grab a copy of the comments
and read through them offline. It does e-mail notification. It lets
people subscribe, too. And you get a recent comments box for free!
I like it a lot. Here's my highly idiosyncratic config snippet: =)
(defun sacha/planner-note-id (info)
"Return the note identifier for commenting systems.
Prefers date pages."
(planner-replace-regexp-in-string
"[#\\.]" "-"
(if (string-match planner-date-regexp (planner-note-page info))
(concat (planner-note-page info) "#" (planner-note-anchor info))
(let (found
(pages (planner-multi-split (planner-note-link-text info))))
(while pages
(when (string-match planner-date-regexp (planner-link-base (car
pages)))
(setq found (planner-link-target (car pages))
pages nil))
(setq pages (cdr pages)))
(or found
(concat (planner-note-page info) "#" (planner-note-anchor info)))))))
;; I want notes preceded by a number so I know how to link to them.
(defun sacha/planner-markup-notes ()
"Mark up notes neatly."
(while (re-search-forward "^\\.#[0-9]" nil t)
(save-restriction
(planner-narrow-to-note)
(let* ((info (planner-current-note-info t))
(id (sacha/planner-note-id info)))
(delete-region (point-min) (point-max))
;; Bound the entire thing in a div
(insert "<div class=\"note\" id=\"anchor-" (planner-note-anchor info)
"\">\n"
"<h3>" (planner-note-anchor info) ". " (planner-note-title
info) "</h3>\n"
"<div class=\"note_info\">Categories: " (or
(planner-note-link-text info) "None") " -- "
(planner-make-link (concat (planner-page-name) "#"
(planner-note-anchor info)) "Permalink")
(format ", <span class=\"commentlink\"><?php
$blog_id='%s';include (BK_PATH.\"/module/blogkomm_show_link.php\"); ?></span>"
id)
", <a href=\"#feedback\">Mail me</a></div>\n"
"<div class=\"note_body\">\n"
(planner-note-body info)
"\n</div><div class=\"note_info\">"
(planner-make-link (concat (planner-page-name) "#"
(planner-note-anchor info)) "Permalink")
", "
(format "<span class=\"commentlink\"><?php
$blog_id='%s';include (BK_PATH.\"/module/blogkomm_show_link.php\"); ?></span>"
id)
", <a href=\"#feedback\">Mail me</a> -- <a href=\"#top\">Back
to top</a></div></div>\n")))))
;; later, after definition of sacha/planner-markup-tasks
(setq planner-publishing-markup
'([emacs-wiki-tag-regexp 0 emacs-wiki-markup-custom-tags]
sacha/planner-markup-tasks
sacha/planner-markup-notes))
I also needed to add
if (isset($_REQUEST['rem'])) {
setcookie ("blogKo_name", $_REQUEST['comm_name'],time()+1209600);
setcookie ("blogKo_mail", $_REQUEST['comm_e_mail'],time()+1209600);
setcookie ("blogKo_www", $_REQUEST['comm_website'],time()+1209600);
}
if (!isset($button)) {
$comm_name = $_COOKIE["blogKo_name"];
$comm_e_mail = $_COOKIE["blogKo_mail"];
$comm_website = $_COOKIE["blogKo_www"];
}
session_start();
$post_url=$page;
$blog_mail='address@hidden';
define (BK_PATH, "/home/sachac/public_html/comments");
to my header.inc.php (see
http://sacha.free.net.ph/notebook/wiki/include/header.phps),
which is the file loaded by http://sacha.free.net.ph/notebook/wiki/.header .
Much fun! =D
--
Sacha Chua <address@hidden> - open source geekette
http://sacha.free.net.ph/ - PGP Key ID: 0xE7FDF77C
interests: emacs, gnu/linux, personal information management, juggling
sachac on irc.freenode.net#emacs . YM: sachachua83
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [emacs-wiki-discuss] Blog comments are surprisingly easy to hack in =),
Sacha Chua <=