<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

    <channel>
    
    <title>Blog</title>
    <link>http://www.digitalnoon.com/blog/index.php</link>
    <description />
    <dc:language>en</dc:language>
    <dc:creator>nikolai07@gmail.com</dc:creator>
    <dc:rights>Copyright 2009</dc:rights>
    <dc:date>2009-06-02T06:22:00-09:00</dc:date>
    <admin:generatorAgent rdf:resource="expressionengine" />
    

    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/digitalnoon" /><feedburner:info uri="digitalnoon" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Conversations for ExpressionEngine</title>
      <link>http://feedproxy.google.com/~r/digitalnoon/~3/LYw89FqQwaE/</link>
      <guid isPermaLink="false">http://www.digitalnoon.com/blog/articles/conversations_for_expressionengine/#When:06:22:00Z</guid>
      <description>A nifty feature, the ability to directly quote or reply to a comment, is unfortunetly missing in ExpressionEngine. No worries, though: this can be easily added with jQuery. In this tutorial we will be looking at how to do just that.
         
            Getting Started
               A nifty feature that's available either as a plugin or natively in most CMS's, the ability to directly quote or reply to a comment, is unfortunetly missing in ExpressionEngine. No worries, though: this can be easily added with jQuery. In this tutorial we will be looking at how to do just that.If you would like to skip the tutorial you can view or download a barebones example.
   The Html &amp; EE Code
   First, let's make our comment submission form..  

&amp;lt;div id="reply"&amp;gt; 
{exp:comment:form}
 &amp;lt;label&amp;gt; 
  &amp;lt;span&amp;gt; Name&amp;lt;/span&amp;gt; 
  &amp;lt;input type="text" name="name" value="{name}"/&amp;gt; 
 &amp;lt;/label&amp;gt; 
 &amp;lt;label&amp;gt; 
  &amp;lt;span&amp;gt; Email&amp;lt;/span&amp;gt; 
  &amp;lt;input type="text" name="email" value="{email}"&amp;gt; 
 &amp;lt;/label&amp;gt; 
 &amp;lt;label&amp;gt; 
  &amp;lt;span&amp;gt; Website&amp;lt;/span&amp;gt; 
  &amp;lt;input type="text" name="url" value="{url}"/&amp;gt; 
 &amp;lt;/label&amp;gt; 
 &amp;lt;label&amp;gt; 
  &amp;lt;span&amp;gt; Message&amp;lt;/span&amp;gt; 
  &amp;lt;textarea rows="6" cols="50" 
  name="comment" id="commentbox"&amp;gt; 
  
  &amp;lt;/textarea&amp;gt; 
 &amp;lt;/label&amp;gt; 
 &amp;lt;label class="submit"&amp;gt; 
  &amp;lt;input type="submit" name="submit" value="send"/&amp;gt; 
 &amp;lt;/label&amp;gt; 
{/exp:comment:form}
&amp;lt;/div&amp;gt;
            
   
  
 And this is how we're going to structure our comments. Feel free to structure them as you wish, but keep in mind that you will have to tinker with the jQuery selectors we're going to use to make it fit your needs later on. Most importantly though, regardless of how you structure your comments, make sure to set the comment container's id to the comment id.   
   
 &amp;lt;ol class="comments"&amp;gt; 
 {exp:comment:entries}
  &amp;lt;li id="c_{comment_id}"&amp;gt; 
   &amp;lt;span class="author"&amp;gt; 
    &amp;lt;a href="{url}"&amp;gt;{author}&amp;lt;/a&amp;gt; wrote:
   &amp;lt;/span&amp;gt; 
   &amp;lt;p&amp;gt;{comment}&amp;lt;/p&amp;gt; 
   &amp;lt;a href="#reply" class="c_reply"&amp;gt;Reply&amp;lt;/a&amp;gt; 
   &amp;lt;a href="#reply" class="c_quote"&amp;gt;Quote&amp;lt;/a&amp;gt; 
  &amp;lt;/li&amp;gt; 
 {/exp:comment:entries}
 &amp;lt;/ol&amp;gt;
  
         
            Adding the Reply Button
            Alright, now to put those quote &amp;amp; reply buttons to good use we will attach an onclick function to find the comment id and grab the author name, url, and comment and have it paste it into the comment textbox.
   Let's start by creating the function for the reply button:
   
$(document).ready(function(){
   $("a.c_reply").click(function() {
   });
});
   Then find the comment id and author name and throw it into a variable 

var author = $(this).parents("li").find("span a").html();
var authlink = $(this).parents("li").attr("id");
            And finally, spit the variables out into our comment textarea
   
var text = $("textarea#commentbox").attr("value");
$('textarea#commentbox').attr("value",text+"&amp;lt;a href='#"+authlink+"'&amp;gt;@"+author+"&amp;lt;/a&amp;gt;").focus();
   Our final code should look something like this:
   
$(document).ready(function(){  
   $("a.c_reply").click(function() {
	 var author = $(this).parents("li").find("span a").html();
	 var authlink = $(this).parents("li").attr("id");
	 var text = $("textarea#commentbox").attr("value");
	 $('textarea#commentbox').attr("value",text+"&amp;lt;a href='#"+authlink+"'&amp;gt;@"+author+"&amp;lt;/a&amp;gt;").focus();
   );
});
         
            Adding the Quote Button
            Now to make the quote button work. We'll start by adding the functionailty of the reply button:
   
$(document).ready(function(){
   $("a.c_quote").click(function() {
	 var author = $(this).parents("li").find("span a").html();
	 var authlink = $(this).parents("li").attr("id");
	 var text = $("textarea#commentbox").attr("value");
   });
});
  Next, we'll grab the actual comment and put it into a variable:
  
var quote = $(this).parents("li").find('p').text();
  And finally, we'll grab any highlighted text and put it into a variable. We'll then replace the whole quote with only the part that is selected:
  
if (window.getSelection)
  var selection = window.getSelection();
else if (document.getSelection)
  var selection = document.getSelection();
else if (document.selection) {
  var selection = document.selection.createRange().text; }        
if(selection!="") quote = selection;  
            Our final code should look something like this:
  
$("a.c_quote").click(function() {
  var author = $(this).parents("li").find("span a").html();
  var authlink = $(this).parents("li").attr("id");
  var text = $("textarea#commentbox").attr("value");
  var quote = $(this).parents("li").find('p').text();
  if (window.getSelection)
	var selection = window.getSelection();
  else if (document.getSelection)
	var selection = document.getSelection();
  else if (document.selection) {
	var selection = document.selection.createRange().text; }        
  if(selection!="") quote = selection;
  $('textarea#commentbox').attr("value",text+"&amp;lt;a href='#"+authlink+"'&amp;gt;@"+author+"&amp;lt;/a&amp;gt;&amp;lt;cite&amp;gt;"+quote+"&amp;lt;/cite&amp;gt;").focus();
});
Putting our code together we should have something that works like this example. You can also download the example here.</description>
      <dc:subject>Articles, Tutorials, ExpressionEngine, jQuery</dc:subject>
      <dc:date>2009-06-02T06:22:00-09:00</dc:date>
    <feedburner:origLink>http://www.digitalnoon.com/blog/articles/conversations_for_expressionengine/#When:06:22:00Z</feedburner:origLink></item>

    <item>
      <title>All Systems Go!</title>
      <link>http://feedproxy.google.com/~r/digitalnoon/~3/nNBI5khzloc/</link>
      <guid isPermaLink="false">http://www.digitalnoon.com/blog/articles/all_systems_go/#When:08:59:00Z</guid>
      <description>For the past couple of months, between work &amp; more work, I've been toying around with my very own site. The project, which remained neglected while collecting dust until a couple of weeks ago, is finally complete.
         
            
            For the past couple of months, between work &amp; more work, I've been toying around with my very own site. The project, which remained neglected while collecting dust until a couple of weeks ago, is finally complete.Why the long wait? Well, While dealing with a marathon of clients the past couple of years through different agencies, I've been growing both as designer and a developer. With every completed project comes a series of stepping stones for improvment (commonly known as "mistakes"). With every project thrown into the "complete" pile, I went back to my own projects and started reworking them using my newly found knowledge. So between switching my website from TextPattern to Wordpress to ExpressionEngine, playing around with both MooTools and jQuery, and jumping around between 5 different designs, I finally settled on what you see today. This is my newly formed e-home where I plan on sharing my thoughts &amp; experiences, tips, and tutorials. It's here. It's finished. Enjoy.</description>
      <dc:subject>Articles, Design</dc:subject>
      <dc:date>2009-05-31T08:59:00-09:00</dc:date>
    <feedburner:origLink>http://www.digitalnoon.com/blog/articles/all_systems_go/#When:08:59:00Z</feedburner:origLink></item>

    
    </channel>
</rss>

