From a programming perspective, I'd like to know if my idea is possible:
Specifically, I want to allow users to "pin" comments anywhere within the text of my blog as opposed to the standard convention of writing in commenting boxes below the article.
All comments are welcome and I'm happy to elaborate if I'm being unclear as to what I'd like to accomplish. Thanks very much for indulging the noobish question. Your expertise is greatly appreciated!
All the best,
Sean
Question regarding plausibility of a specialized commenting system.
Started by wilkinsonsm4, Oct 25 2010 04:13 PM
7 replies to this topic
#1
Posted 25 October 2010 - 04:13 PM
|
|
|
#2
Posted 25 October 2010 - 05:01 PM
It could be done. You just need to include where you want it included.
#3
Posted 25 October 2010 - 05:34 PM
Thanks for the quick reply, WingedPanther. It's exciting to hear it can be done. Since I posted the question, I've been doing some searching and found a site that sort of implements the commenting system I'm envisioning. Text of H.R.3590 as Amendment in Senate (OC Prepared): Patient Protection and Affordable Care Act - U.S. Congress - OpenCongress. This is a congressional bill from Open Congress, a site which allows you to read bills before they're passed into law. When it loads, you can see that it allows you to leave comment line by line. This is very close to the sort of technology I would like to pursue.
For me to implement it on my site, I'd like users to be able to upload their own material for others to leave comments in much the same way. I envisioned it word by word but as I said, line by line is quite close to the goal and I'm very curious how they achieved this. It seems very cutting edge. If anyone has insight as to how they think they did this, it would be of enormous help to me. Thank you.
For me to implement it on my site, I'd like users to be able to upload their own material for others to leave comments in much the same way. I envisioned it word by word but as I said, line by line is quite close to the goal and I'm very curious how they achieved this. It seems very cutting edge. If anyone has insight as to how they think they did this, it would be of enormous help to me. Thank you.
#4
Posted 25 October 2010 - 05:45 PM
Each line is generated in a <div> with a different ID attribute (i.e. id="node_xxx"). When the user hovers over the line, you can use a Javascript attribute such as this (a simplistic example):
<!-- onMouseOver to highlight, onClick to show comment form -->
<div id="node_231" onMouseOver="document.getElementById('node_231').bgcolor = blue;" onClick="(ajax code here to load comment form)">
(bill paragraph here here)
</div>As the code employs Javascript that can talk with a comment form, such as in PHP or ASP it requires AJAX, thus an AJAX form can be used to leave the comment on each line that is clicked on.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#5
Posted 25 October 2010 - 05:57 PM
Many thanks for your insight Nullw0rm! As always, impressive and very intriguing! It must be that when the bill is uploaded, some sort of automation occurs that makes the manual insertion of a <div> for each line of text unnecessary. Further investigation shows that the site is a Ruby on Rails project and I wonder if that framework dictates the automation somehow.
Edit: Or does pasting my entire text into the part of your example code which reads, (bill paragraph here) divide it line by line in the way it is on the OpenCongress site? That would be very easy.
Edit: Or does pasting my entire text into the part of your example code which reads, (bill paragraph here) divide it line by line in the way it is on the OpenCongress site? That would be very easy.
Edited by wilkinsonsm4, 25 October 2010 - 06:01 PM.
thought of something that might need clarification
#6
Posted 25 October 2010 - 09:50 PM
The document must had been originally in XML format, Ruby (but PHP can easily do so) split the paragraph elements into divs and output them to the screen, of course automating each ID to be a specific number for the Javascript to work. You can do line by line rather than paragraph by paragraph with that automation, I am not aware of any framework.
Another simplistic example in PHP:
Another simplistic example in PHP:
$num = 0;
$lines = explode("\n", file_get_contents('foo.txt'));
foreach($lines as $line) {
print "<div id='node_$num' onClick='(jscode)' onMouseOver='(jscode)'>";
print "$line";
print "</div>";
$num++;
}
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#7
Posted 25 October 2010 - 11:27 PM
Any particular reason why this is in the Java Help category?


Sign In
Create Account


Back to top









