Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Quoting?

135

Comments

  • right. just tested in camino (osx), and we have problems. It does not recognise that I have selected text.
  • edited August 2005
    Just to get things rolling a bit, I've hacked my forum a bit to add a quote button, so I'll share what I did, and what I plan to do next. First time I tried to hack Vanilla forum, so might be a messy for some peoples tastes: in /controls/comments.php, find: $sReturn .= "<div class=\"CommentBlockComment\"><a id=\"BlockComment_".$Comment->CommentID."\" href=\" Before this, add: $tempPost = str_replace("\r", " \n \\", addslashes($Row["Body"])); $sReturn .= "<script> function QuoteUser(who,what) { document.frmPostComment.Body.value = document.frmPostComment.Body.value + '[code][b]Originally Posted by ' + who + '[/b]\\n\\n' + what + '[/code]\\n\\n'; } </script><div class=\"CommentBlockUser\"><a id=\"QuoteUser_".$Comment->AuthUserID."_Comment_".$Comment->CommentID."\" href=\"javascript:QuoteUser('" . $Row["AuthUsername"] . "','" . $tempPost . "');\">quote post</a></div>"; I found $Comment->Body to have HTML and it would mess up the JS a bit, and I couldn't find a similar non-formatted one, so I used the values from $Row. Another idea I have, is that the user can select the text that they only want to quote, and they click quote, and it will insert only that text into the add comments box as a quote. This shouldn't be too hard to implement, so I'll give it a go tommorow. (There's an example above; only saw it after I posted!)
  • extension != messy hack
    :D
  • Not sure how else I can get a button up there amongst the other ones; how is it supposed to be done?
  • http://lussumo.com/docs/ :D
  • Its my opinion that the extension would work like it does on other boards...that is, you click on a button (this button is available on each post), and it automatically puts the entire post that you just "quoted" down into the text area.
  • i think that is the aim. I understand that there has been some other code thrown around here, but I am sure that is just for refernce/ example.
  • edited October 2005
    I needed quotes, so i modified the bbcode extension like this: $String = preg_replace("/\[quote\](.+?)\[\/quote\]/","<strong>QUOTE:</strong><span class=\"quote\"><br />$1</span>",$String); and added the following css to master.css .quote { display: block; /*behaves like a block level element so fills the available width and returns the text beneath it*/ padding: 3px; /*pads the whole thing*/ border: 1px dotted Silver; /*dashed border around it*/ background-color: #F5F5F5; /*and the background color*/ } it mimics the behavior of our exsisting fourms quite well.
  • I made a quick extension to add CSS for blockquotes and code tags, since most styles dont have it (I think?).

    Get it here
    HT Forum thread

    Helpful, although I dont think it does the same as what you did.
  • 51! ahhh. old times.
  • edited October 2005
    [I made a quick extension to add CSS for blockquotes and code tags, since most styles dont have it (I think?). ] You're right It's a very different thing but then again you have to have BB Code active to use my method which is a bit of a hack in itself.
  • BenBen
    edited October 2005
    I know my style supports code and blockquote
    Shameless plug I know...
  • Thinking about the quote thing and having the chance to work with Wiki engines I would almost like to somehow implement the nice Wiki formatting engine for Vanilla since I love both so very much. So links would be like [url name] and you could make text italic by ''just typing stuff inside two single quotes'' and maybe add some new tags like quoting would be something like this ['name|a quotation from the person'] it would rock so very much.
  • i must say i was very impressed with the wiki engine and how easy it was to make something look asif it was actually meant to be there (compared to some useless drivel minisweeper wrote ;))
  • Any update on quoting? I would really love to see this added somehow.
  • edited December 2005
    I just wanted to throw this out there for some people. I'm sure you can make use of it and then modify it as you see fit. I modified the BBCode and Smilies extension. With the following code that has to do with quotes: $String = preg_replace("/\[quote\](.+?)\[\/quote\]/","<div class=\"quotetext\">$1</div>",$String); $String = preg_replace("/\[quote=\"(.+?)\"\](.+?)\[\/quote\]/","<div class=\"quote\"><div class=\"author\"><strong>$1</strong> wrote:</div><div class=\"quotetext\">$2</div></div>",$String); //quote a specific person [quote="person"] So now you have two different options as far as quotes go (one with an author and one without). Then my css looked like this: .quote{ } .author{ font-style: italic; padding-left: 5px;} .quotetext{ background-color: #F5F5F5; padding: 5px; border: 1px dashed #c1c1c1; } You can modify that as you see fit for your Vanilla install. The next thing I plan on doing is adding a "quote" link for every comment that will copy the necessary information over to the comment box for ease of use. I'll keep everyone posted on my progress with it. Cheers
  • edited December 2005
    domosapien: you do realize that HTML has blockquote tags for just that very purpose, right? No need to make a custom class just for that.

    And I can write the javascript for the quote buttons if you'd like.
  • edited December 2005
    i've implemented Karthicks (on the first page) which works really well. i adjusted it to output html though instead of bbcode.

    $tempPost = str_replace("\r", " \n \\", addslashes($Row["Body"])); $sReturn .= "<script> function QuoteUser(who,what) { document.frmPostComment.Body.value = document.frmPostComment.Body.value + '<blockquote><p><strong>' + who + ' said:</strong>\\n' + what + '</p></blockquote>\\n\\n'; } </script><div class=\"CommentBlockUser\"><a id=\"QuoteUser_".$Comment->AuthUserID."_Comment_".$Comment->CommentID."\" href=\"javascript:QuoteUser('" . $Row["AuthUsername"] . "','" . $tempPost . "');\">quote post</a></div>";

    unfortunately it breaks if a post contains an href using ""s but if it is posted like so it is ok:

    <a href='http://www.domain.co.uk'>domain</a&gt;
  • edited December 2005
    I was considering using <blockquote><cite>author name</cite>quoted text</blockquote>, but thought it was a bit limiting for the styling I wished to do. I wanted the "Author wrote:" text to remain outside of the actual quoted text. I suppose something like this would do the same: <blockquote> <cite><strong>Author</strong> wrote:</cite> <div class="quotetext">Lorem ipsum dolor.</div> </blockquote> And then styled appropriately. I may change what I did to that. As far as a quote button I was imagining a link up in the corner of each comment. Right next to the whole "block comment", "block user" bit. After clicking on that link it would naturally paste the appropriate information into the comment box. I haven't looked at it to see if you can do that with javascript, but I'm also no pro at javascript. While it would be nice to do it client-side I would be happy with a server-side solution. More than anything though I just wanted to get the quoting discussion going again. There were no comments for nearly two months and it didn't seem a solution had been nailed down yet. I just installed vanilla for the first time a few days ago and have been trying to get it where my users will be happy with it. Quotes seems to be a "must-have feature".
  • Let me give it a shot tonight.
This discussion has been closed.