Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 281663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:13:20+00:00 2026-05-12T05:13:20+00:00

I am working on a website in PHP where people can make comments similar

  • 0

I am working on a website in PHP where people can make comments similar to a blog, and I only want particular tags to be allowed. Are there any pre-built libraries that process comments and produce valid XHTML Strict code? I would need to do this in JavaScript so I can generate a live preview like Stack Overflow, plus in PHP before saving it to a MySQL database.

The allowed HTML tags will be: strong, em, blockquote, and links (rel=nofollow not required)

One way would be to allow people to directly enter the HTML into the comment field but I would prefer to use a simple mark up something like this (can be different – this is an example):

*strong*
_em_
[blockquote]
http://www.link.com

I want line breaks to be converted to <br />.

Are there any code libraries that do the above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:13:21+00:00Added an answer on May 12, 2026 at 5:13 am

    I personally think that it is better to allow normal html tags.
    Yet another markup with its own little variations is less usable.

    Jakob’s Law of the Web User Experience states that:

    "users spend most of their time on other websites."

    So you need to do it like most other sites do.

    That leaves you with:

    • HTML -> Use HTML Purifier to filter just the tags you want. I like this method.
    • Markdown -> This syntax is similar to what you want and stackoverflow uses it. You can parse it with PHP Markdown
    • BBCode -> I don’t have experience with this but in php 5.2 seems to come already installed: PHP BBCode or there are older libraries to parse it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a website, and I'm implementing a friend system. People can become
i'm working on a website. I have a file in php and I want
I'm working on a website with a em-based layout (so it can stretch and
I'm working on a website where I want camera-recorded vidoes to be uploaded, and
I am working on an AJAX website where there are two search parameters. I
I was working on a rewards website in php and mysql. I have almost
i am working on an e-commerce website using php. i have tried post/get and
I am working on a simplistic website using PHP, a language I haven't touched
I'm working on my website made from php, and my programmer put the following
I am on working on a personal project to write a PHP website which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.