Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion

Quoting?

edited March 2006 in Questions
Has anybody written a quoting extension yet? Like a button or link on a post that will quote it in the reply box at the bottom, in a format that will make it readable if text-only, or markdown, or html or whatever...
«134

Comments

  • Quoting is really only a matter of assigning a different class to a paragraph/div and giving it a different color. It would be a simple addition, but it would be very useful.
  • edited July 2005
    How simple? I could probably do it myself with a few pointers.. And how would it work seamlessly with Text, Markdown, Html, BBCode, etc? And adding a simple div thing to format it differently won't help actually getting the quote in the message in the first place unless you copy/paste text. :)
  • edited July 2005
    Quoting should be done like so: <blockquote cite="originalPostURL"> <cite>user wrote:</cite> quoted comment goes here </blockquote> And then styles should be applied to the blockquote and cite elements in the forum stylesheet. As far as compatibility goes, I assume Markdown and BBCode would translate their syntax to this semantically correct type of markup, anyway. EDIT: Why does code enclosed in <code> tags still render in HTML mode? :( Am I being dense?
  • You have to escape your HTML for it to show the >s and the <s. http://www.accessify.com/tools-and-wizards/quick-escape.asp - Pop your HTML in, get escaped HTML out. M.
  • I thought the point of the <code> tag was that you didn't have to escape within it?
  • Scottish, the BBcode file is incomplete, I've added some more commands to mine, if you open up extensions/bbcode.php and replace the current BBencode function with the code below - you will get more BBcode functionality.


    function BBEncode($String) {
    //[img] tags
    $String = preg_replace("/\[img\](.+?)\[\/img\]/","<img src=\"$1\" />",$String);
    //[url] tags
    $String = preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/","<a href=\"$1\" target=\"_blank\">$2</a>",$String);
    $String = preg_replace("/\[url\](.+?)\[\/url\]/","<a href=\"$1\" target=\"_blank\">$1</a>",$String);
    $String = preg_replace("/\[email\](.+?)\[\/email\]/","<a title=\"Send an Email to this address\" href=\"mailto:$1\">$1</a>",$String);
    // other stuff
    $String = preg_replace("/\[b\](.+?)\[\/b\]/","<strong>$1</strong>",$String);
    $String = preg_replace("/\[u\](.+?)\[\/u\]/","<span class=\"underline\">$1</span>",$String);
    $String = preg_replace("/\[i\](.+?)\[\/i\]/","<em>$1</em>",$String);
    $String = preg_replace("/\[code\](.+?)\[\/code\]/","<code>$1
    ",$String);
    $String = preg_replace("/\[quote\](.+?)\[\/quote\]/","$1",$String);
    $String = preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/","$2",$String);
    $String = preg_replace("/\[img\](.+?)\[\/img\]/","\",$String);
    return $String;
    }
  • Hey cool, thanks :) Still, it'd be nice to have a quote button on each post which auto-populates the reply-box with the quote.
  • definatley agree, its a key feature of messageboards which is actually worthwhile!
  • i also agree. my users are dying for this feature.
  • MarkMark vanilla
    hey stuart - want to link that extension up on the wiki?
  • edited July 2005

    You can fake it, no?

    Outbreak said: i also agree. my users are dying for this feature.

    Hm.

  • I was thinking of just a simple JS way to do this, which I thought would be feasable..

    User clicks on Quote button on certain post, that entire post is copied into the message box with needed code; blockquote, cite etc.

    Logically it should work with a little tweaking of certain things...
  • Something that needs to be taken into consideration is that we'll need some CSS to pretty it up. We could theive the CSS already used for the <code> blocks... perhaps just alter the colors? But the important question is... where does it go? Can an extension insert CSS into the default stylesheet? What if a user is running a different style? Hrmmm....
  • my feeling is that the default stylesheet should cover blockquote as it's a pretty standard piece of markup. I've altered my own local vanilla style to include this, it looks pretty much like <code> but with different colors and borders. my feeling on the second question is that theme authors should be thorough but you really can't control that, so fuck it. as long as the html is sensible there's no reason it shouldn't display reasonably on any complete style.
  • You'll also need to take into account for the text formatting that user is using, are you going to be quoting in plain text, html, markdown... ?
  • it shouldn't matter, as mentioned above, since all those parsers simply translate whatever you've written to html. so by the time it's quotable, it's HTML and nothing else.
  • Since I've been using the wiki lately, I've been finding it a breeze to mix some html in with markdown and plain text all in one shot. I think what could probably be done, is instead of having to pick between the 3 or more format types, one parser does the job for all differentiating between different markups to reach it back to output proper html.
  • edited July 2005
    Yeah, the thing is, Unipus... if you put HTML quotes into the comment input box... and the entry mode is Text... it will escape all the HTML and not render the quote properly.

    I agree with your feeling that the default stylesheet should cover it. You're right about the fact that if the HTML is sensible, it should display reasonably. Well, you can see what it does unstyled already. (Adding in <b> around the username from my previous sample code.)

    Scottish wrote:
    It looks pretty decent.
    I Maybe we pull together some CSS for Mark to put in, if he's okay with that?
  • Oh, something else I just thought of. We could link the <cite> part of it to the original post. Making the code something like: <blockquote cite="originalPostURL"> <cite><b>user</b> <a href="originalPostURL">wrote</a>:</cite> quoted comment goes here </blockquote>
  • You would need to do either 1 of 2 things in this scenario both involving JS. #1 would be grabbing the selected post text, copying it and throwing it into the add comment box. or #2 doing the same except already having the appropriate JS loaded into a quote button with the users comments preformatted within the source waiting for the copy job. Much like your markup code buttons idea. So it would need to be via source rewriting extension with JS or via pure JS.
  • I feel so intimidated by the geniuses on this forum that I was almost too scared to say anything, so if what I say is stupid, my bad. Would JS be necessary? Can't you just use a PHP get function and get the post's text? So the url would be something like http://forums.myserver.com/thispost?quote_postid=23 ...or something like that. The 'Quote' button below each comment would just follow the same logic in the loop that spits out the comments, so defining the postID wouldn't be too tough (I think). And the text of each post is right there in the database. So if you grab it, and then change the code of the textarea for the reply to <textarea><?php get_quote($postid); ?></textarea> wouldn't it work? Of course the get_quote function would wrap the <blockquote> tags around the post text.
  • yeah sumeet that could work, except I think we're tryign to make it work with vanilla's current "Add your comments" box that's already there at the bottom rather than loading a seperate page. lech: your idea #2 that preloads all the quote text in javascriptr.. eeeek that could lead to potentially huge page downloads. If all else fails we can always do it sumeet's way I suppose!
  • I'll have to momentarily set aside my shock of not being heinously wrong... Is loading a new page that much different than calling a JS function? It seems to me that, given the nature of Vanilla, new page loads would be quick and painless. And, of course, I try to use as little JS as possible - whever possible ;-)
  • Or, you can just tell your users to get a life and just deal with it. That, or learn some HTML. </sarcasm> I really think that the [quote] function is an excellent idea. But, in the end, it's unnecessary to spend gobs of time if this forum wasn't meant to include. Just a thought. </negativity>
  • i'm not really sure why you'd want to avoid using javascript on a board that is built on a solid foundation of javascript. besides, making a proper quote function out of javascript is very, very trivial. seriously, all you need is one anchor for each post that references the post (which, by the way, the actual markup on the comments pages is extremely difficult to work with in javascript, and i've been meaning to mention my suggestions to mark) and puts the proper text in the reply box. i understand that there are browser compatibility issues to be passed, but i'm pretty certain that vanilla also uses an ajax backend, and might be able to asynchronously and dynamically update this using php by way of ajax. but i'm not in any position to comment on that.
  • p.s. it should work like the 'whisper back' thing
  • I think I just realized a flaw in this whole idea... max page limit vs post reply box being on last page if the thread is already multiple pages. The one idea could indeed lead to a larger page download but it's a sure-fire way of quoting and I've done it before. however because of what I just said, I'm not sure if this will even be possible because once there are say 50+ posts and the reply box is on the next page, you're dead in the water.
  • Using the PHP get function would solve that problem. Simply link the quote button next to each post to #addcomments... oh, wait now I understand where the problem lies. Hmmmmmmm.
  • Instead of quoting as such, couldn't we come up with a way of 'referencing' different posts. This way, you would something like: ref:post_13 to your comment, and that comment, along with the name of the member who posted it could be added wherever you want within your post. This wouldn't be ideal as you couldn't do any sort of editing, say if you just wanted to quote a small part of a post, or you wanted to highlight a certain section of it. ut it would seem to go someway to solving the problem.
  • i thought something like that stuart, it'd help keep db size down too (for what it's worth)
«134
This discussion has been closed.