How to create custom [QUOTE] tag?

1.2k views Asked by At

I'm developing a forum software suite and I'd like to create a custom html [QUOTE] tag for quoting posts. I've managed to create a nice looking custom <quote> tag using css but I can't find a way to display the quoted user in the head of the quote without having to include an element to contain it. I'd like to create something like this...

[QUOTE name='Fred']
Hi there!
[/QUOTE]

The name in the head of the quote should be displayed in the top border of the quote element.

Suggestions?

1

There are 1 answers

4
Tim Wißmann On BEST ANSWER

I think the simplest way would be to use a free library, like BBCode. Then you don't have to reinvent the wheel. A standard quote-tag is built-in the BBCode library, so you don't have to worry about it.

Usage Example

Quoting noone in particular
[quote]'Tis be a bad day[/quote]
Quoting someone in particular
[quote=Bjarne]This be the day of days![/quote]

One implementation of BBCode is a PHP-Parser, which enables you to convert plain text parts to html code. One disadvantage is, that you need a running php backend on the server, but I suppose you already installed something like this on your server.

Have a look at the website of it: http://christian-seiler.de/projekte/php/bbcode/index_en.html


EDIT:
An important information, that you should know:
The BBCode is written by the User. Your task is (the task of PHP) to convert automatically the written Syntax to HTML or something else.
You could also write your own Parser in PHP, but that means more work for you and maybe the result will become more error-prone then. A library makes something much more easier.
BBCode also gives you some predefined BBCode-Tags (eg. the Quote-Tag, as shown above).