I have a web of static pages, and would like to allow adding comments at the
ends of any of those pages (and display with those comments). Not
(currently) on Rails or any such framework.
Any suggestions on simple ways (preferably Ruby-based) to do this? Or where
would be a good place to start looking?
I have a web of static pages, and would like to allow adding comments at the
ends of any of those pages (and display with those comments). Not
(currently) on Rails or any such framework.
Any suggestions on simple ways (preferably Ruby-based) to do this? Or where
would be a good place to start looking?
Thanks.
How about Instiki? If it doesn't already, perhaps it can be modified to keep certain portions of the page static.
Iff the pages are XHTML, it should be really easy to parse them with
REXML, add what you want, and dump them back out again, all with a
script. I'd search to the end of <body>, or some other easy to define
tag (perhaps right after an <hr> with id='postsgohere', even).
The script to do that would trvially be about 20 lines long; perhaps a
bit more with aggressive error checking.
Ari
···
On Fri, 21 Jan 2005 03:35:59 +0900, itsme213 <itsme213@hotmail.com> wrote:
I have a web of static pages, and would like to allow adding comments at the
ends of any of those pages (and display with those comments). Not
(currently) on Rails or any such framework.
Any suggestions on simple ways (preferably Ruby-based) to do this? Or where
would be a good place to start looking?
And not have to change the static pages, keeping comments in a file or
database keyed on the page name. You could even use mod_rewrite to do
this automatically, changing no links on the site.
A simple eruby solution would involve changing all the pages from
.html to rhtml and use eruby and embedding ruby in the pages. That
could be automated with a script to add some ruby code to the bottom
of each page to include the comment logic.
Nick
···
--
Nicholas Van Weerdenburg
On Fri, 21 Jan 2005 03:35:59 +0900, itsme213 <itsme213@hotmail.com> wrote:
I have a web of static pages, and would like to allow adding comments at the
ends of any of those pages (and display with those comments). Not
(currently) on Rails or any such framework.
Any suggestions on simple ways (preferably Ruby-based) to do this? Or where
would be a good place to start looking?
That describes a way to attach a PHP file at the beginning and end of
every file in a directory. Instead of a word highlighting script,
replace it with a script to pull comments from a database. The last
step is to set the following in your .htaccess file to make html files
act as PHP files:
AddType application/x-httpd-php html htm
Can this be done with Ruby?
Douglas
···
On Fri, 21 Jan 2005 03:35:59 +0900, itsme213 <itsme213@hotmail.com> wrote:
Any suggestions on simple ways (preferably Ruby-based) to do this? Or where
would be a good place to start looking?
I have a web of static pages, and would like to allow adding comments at the
ends of any of those pages (and display with those comments). Not
(currently) on Rails or any such framework.
Any suggestions on simple ways (preferably Ruby-based) to do this? Or where
would be a good place to start looking?
Seems this would be a good use of an Apache output filter. I don't think mod_ruby supports writing output filters yet but I think you can do so in perl or python.
If you really want ruby it sounds like a combination of mod_rewrite and a ruby script as Nick suggested would be your best route. You could also use mod_ruby as a handler that will handle all requests and use the request string to figure out what file to load. This would be similar to the mod_rewrite/script suggestion except your script is more integrated with Apache.
On Fri, 21 Jan 2005 04:25:58 +0900, Aredridel <aredridel@gmail.com> wrote:
Iff the pages are XHTML, it should be really easy to parse them with
REXML, add what you want, and dump them back out again, all with a
script. I'd search to the end of <body>, or some other easy to define
tag (perhaps right after an <hr> with id='postsgohere', even).
The script to do that would trvially be about 20 lines long; perhaps a
bit more with aggressive error checking.
"Nicholas Van Weerdenburg" <vanweerd@gmail.com> wrote in message
Do you want to add anything to the static pages, or do it all
magically without touching them?
I can add to the static pages, as I generate them statically from Ruby.
From the suggestions so far, one lightweight approach seems to be to have a
comments file per static html file. At the bottom of each static html file I
could include an <iframe> or <object> to show current comments via some
comments_for(x) script, and a form that submits to some add_comment_for(x)
script.
Thoughts?
This will be my very first venture into the web with Ruby so please excuse
my naivete. If I do this on a LAMP web host with Ruby and cgi (not too
worried about performance of the comments right now), would it be anything
like this: