Skip to main content
How to add the 1.1.9 Quick Quote Function to your theme Started by Spuds · · Read 6400 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

How to add the 1.1.9 Quick Quote Function to your theme

If you are running a custom theme, there is a good chance that the 1.1.9 patch will not be able to update your theme files.  The theme will still work w/o the updates, it will just lack the new functionality.  Below is how you would make the edits to add quick quote.

The quick quote function is where you highlight a section of another post and are presented with a quick quote button.  This allows you to selectively quote just a portion of another post in your reply.

How to add

In display.template.php find the div/section that holds the post body, it will look like:
Code: [Select]
		// Show the post itself, finally!
echo '
<section id="msg_', $message['id'], '" class="messageContent', $ignoring ? ' hide"' : '"', '>',

$message['body'], '
</section>';
You need to add two things. 
  • A data attribute to the div/section which allows JS to easily grab the message ID.  Note: The class name on the div/section must be messageContent or you will have to update the JS accordingly
  • A hidden button that holds the quick quote, it will be positioned by the caret when the text is highlighted.
Code: [Select]
		// Show the post itself, finally!
echo '
<section id="msg_', $message['id'], '" data-msgid="',$message['id'], '" class="messageContent', $ignoring ? ' hide"' : '"', '>',
$message['body'], '
</section>';

// This is the floating Quick Quote button.
echo '
<button id="button_float_qq_', $message['id'], '" type="submit" role="button" style="display: none" class="quick_quote_button hide">', !empty($txt['quick_quote']) ? $txt['quick_quote'] : $txt['quote'], '</button>';

IMPORTANT The button positing is absolute from the top of the page.  If your theme sets a position: relative on a parent container of the button, then the position will be wrong (it will be absolute from the parent container that is relative).  In this case it will position too far down the page, possibly even off screen.  Things you can try:

  • Moving the button location in the template.  It does require it be somewhere inside each posts container to allow resetting the UI on de-selection.
  • OR  you will need to change the logic in quickQuote.js function Elk_QuickQuote.prototype.setButtonPosition()
  • OR think about why you have a relative parent container and if its necessary

.