son.of.the.morning Posted December 9, 2011 Share Posted December 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/ Share on other sites More sharing options...
litebearer Posted December 9, 2011 Share Posted December 9, 2011 Might consider something like... http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296147 Share on other sites More sharing options...
trq Posted December 9, 2011 Share Posted December 9, 2011 Cool. Do you have a question? Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296149 Share on other sites More sharing options...
son.of.the.morning Posted December 9, 2011 Author Share Posted December 9, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296155 Share on other sites More sharing options...
trq Posted December 9, 2011 Share Posted December 9, 2011 Google for "php bbcode" examples. Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296157 Share on other sites More sharing options...
litebearer Posted December 9, 2011 Share Posted December 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296162 Share on other sites More sharing options...
Adam Posted December 9, 2011 Share Posted December 9, 2011 Rather than 'reformatting' each time the content is viewed, simply do the formatting prior to saving the content. Then how will the user edit it afterwards? Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296278 Share on other sites More sharing options...
scootstah Posted December 9, 2011 Share Posted December 9, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296284 Share on other sites More sharing options...
litebearer Posted December 9, 2011 Share Posted December 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296308 Share on other sites More sharing options...
scootstah Posted December 9, 2011 Share Posted December 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296311 Share on other sites More sharing options...
litebearer Posted December 9, 2011 Share Posted December 9, 2011 So you are saying that forums NEVER store content that uses Bold, Italic, color, font, underscore? Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296313 Share on other sites More sharing options...
ddubs Posted December 9, 2011 Share Posted December 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/252816-this-is-a-long-shotbut-here-it-goes/#findComment-1296329 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.