Jump to content

Recommended Posts

I would like to apply some addition functionality to a form which add news records into the database. Basicaly what i want is similar to what this forum does with the [ code ] [ /code ] but what i want for the user to be able to add [ quote ] [ /quote ] and when the post is viewed then that specific area of the acticle body will be formated diffrently. I hope this makes sence.

Link to comment
https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/
Share on other sites

it's not realy the form i have an issue this it's when the article is viewed i want to be able to check the article body for something like [ quote ] [ /quote ] and if it finds it wrap it in a tag with a class so i can have a difrent style applied to it

I would like to apply some addition functionality to a form which add news records into the database. Basicaly what i want is similar to what this forum does with the [ code ] [ /code ] but what i want for the user to be able to add [ quote ] [ /quote ] and when the post is viewed then that specific area of the acticle body will be formated diffrently. I hope this makes sence.
This would indicate you want the user supplying the content to determine when, where and how the text would be formatted.

 

Rather than 'reformatting' each time the content is viewed, simply do the formatting prior to saving the content.

 

Rather than 'reformatting' each time the content is viewed, simply do the formatting prior to saving the content.

 

I strongly disagree. Number one, any editing will need to be UNformatted, and number two you destroy the ability to reuse the data. What if you ever want to format it in a different way in the future? What if you change your algorithm? What if you want to use the data in a different way?

 

 

one must remember the question asked about VIEWING not editing. Does viewing mean by the 'author'? or other users? Is anyone allowed to edit the content? many scenarios may be put forth, it all depends.

 

It doesn't matter. Unless specific circumstances say otherwise, you should never store formatted content.

So you are saying that forums NEVER store content that uses Bold, Italic, color, font, underscore?

 

Correct, they save the BB-code and re-parse using templates when the data is recalled out of the DB. Infact, you'd probably only want to allow BB-style code and strip HTML from posts/comments to prevent XSS.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.