Ready for regular expressions Dec20 '04
Feedback
# (2 of 4): Matthom
2 hours, 39 minutes after the fact. (Mon 20 Dec 2004, 6:29 PM CST)
Dale, cool. You make a good point. After all, there is no harm in storing the HTML in the database, because if I want it removed, I can just use a function that strips out the HTML elements.
And, I also use that "autop" script for when comments are inserted.
However, the problem comes up with images, and other such HTML that just doesn't belong in the database.
And what about paragraphs that have a class applied to them? What if that class is changed down the road?
These are things that are making me question my whole approach of storing FORMATTING elements within my content.
# (3 of 4): Dale » blog.dalegroup.net
6 hours, 14 minutes after the fact. (Mon 20 Dec 2004, 10:04 PM CST)
Mmm formatting is a good question. You COULD write a bb-like-code thing to do div styles.
So [quote]bla[/quote] which then gets converted to the right html. But you'd still need to do this for all your different styles and tags etc.
If you did need to change something from the database you could just write a script that takes the div tag out of the database and changes it to the new div style.
I'm not sure what the best way to handle formatting is. Both storing HTML in the database and using BBcode isn't the best. Although I don't see a way around it.
I'd head the HTML in database way...
# (4 of 4): Matthom
14 hours, 29 minutes after the fact. (Tue 21 Dec 2004, 6:19 AM CST)
Dale, good enough. Thanks for your input.
RSS feed for comments on this post
Leave feedback
matthom
is published and produced by Matt Thommes - an independent publishing enthusiast, mobile blogger, content creator, informative writer, web developer from Chicago.
Never one to conform, Matt intends to promote the effect the web has on our lives, in an effort to intensify, instruct, and clarify all that is happening around us.
I am currently looking for some good resources (help!), or tips on using regular expressions in PHP.
You are at the feedback permalink page for: Ready for regular expressions
# (1 of 4): Dale » blog.dalegroup.net
35 minutes after the fact. (Mon 20 Dec 2004, 4:25 PM CST)
I think storing HTML in the database is good. Although not everything. You can convert new lines (\n) to
using a cool script from photomatt, Extended autop which can be found here: http://photomatt.net/scripts/autop That is what I use in my blogging system.Storing HTML in the database means that you can store almost anything and you are not confined to functions that you have coded yourself, such as bbcode ([b][/b]) which is what I currently use.
Then if you want to remove certain html from posts (such as comments) just use this function http://sourceforge.net/projects/kses/
Hope that helps.