-1

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?

Tim Wißmann
  • 647
  • 6
  • 18
  • 1
    1. Pick a programming language. 2. Design your custom markup language. 3. Write a parser for your custom markup language. 4. Write an HTML generator. – Quentin Nov 26 '14 at 19:42
  • Does your quote tag use square brackets indeed? If so, how did you manage to style them at all? – GolezTrol Nov 26 '14 at 19:43
  • I'm currently using but a custom tag with square brackets would look better. My main issue is figuring out how to display the quoted user in the top of the block without creating a div to contain it. – Kendrick Bracewell Nov 26 '14 at 19:45
  • 1
    You should show the CSS you have now and explain what you mean by displaying a name *in* a border. Does that mean that you have a border that is wide (tall) enough to contain text? Moreover, you should probably consider using `
    ` with a `data-name` attribute instead of a custom (i.e. nonstandard) tag.
    – Jukka K. Korpela Nov 26 '14 at 19:52

1 Answers1

0

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).

Tim Wißmann
  • 647
  • 6
  • 18
  • Don't know why I didn't think about using BBCode. Thanks! – Kendrick Bracewell Nov 26 '14 at 21:53
  • Let me know, if my answer solved the problem by marking it as "accepted". This will help other users, that have the same problem ;) – Tim Wißmann Nov 26 '14 at 22:04
  • I've done a bit of research and I'm having a hard time finding a good method for implementing BBCode. I could replace [quote] blocks with a few
    elements that have styling but I's rather the code stay formatted as BBCode. For example in XenForo when you quote a post it creates a BBCode [quote='user'] block and displays a styled block containing the quoted post and the user who receiving the quoting.
    – Kendrick Bracewell Nov 26 '14 at 22:42
  • Because I think, that you're not really understand the way BBCode works, I edited my answer for you. Please have a look. – Tim Wißmann Nov 26 '14 at 23:22