VamVan wrote:
On Tue, Jan 13, 2009 at 6:49 PM, Daniel Kolbo <kolb0057@xxxxxxx> wrote:
Hello,
I've been using PHP and Smarty for several years now and I am happy with
this "division" of data from presentation. With this philosophy in mind, i
am a bit perplexed as to how to handle the text on my sites. That is, the
text is data, so i am motivated to store the text in a database, files, or
the like, but then text is loaded with little markup nuances (random
italics/weight/colors, etc...) that make template design rather ugly. This
motivates me to put markup (maybe even my own brand of markup) around the
text, and to store this markup-text combination in a database. But I don't
like this either, because a lot of the people writing the content/text know
word/writer not markup. So i am motivated to have them save their text as
.html, and I parse this file and modify accordingly. However, i don't like
this either as not all word/writer styles are 1-to-1 with CSS. Without any
options I am back to thinking "hard code" the text with markup in included
templates, but it hurts just thinking of updating/modifying.
I have looked (briefly) at Web Content Management Systems, but this seems
like overkill really, maybe i'm ignorant.
What would the community suggest? The text can take on many forms,
introduction text, about text, product information, articles, blurbs, (some
changes daily, some doesn't) etc...where does all this text live in
'properly' designed site.
Thanks in advance,
dK
For specific requirements like this. I think it is very OK to set some
rules when the user inputs the text. You can make the simple text area and
make some custom tags for ur application only. For example <bold> in ur
application means <b> in html.
This way you can str_replace all that user enters in to watever class or
text u want to to make it look pretty. Its an easier way and reliable way
because you have the authority to validate user input if it does not match
certian criteria that you may need.
I don't know you can never blame user for what he enters. Not every user is
computer literate and our code should always cater the needs of this kind of
user and I feel its perfectly ok to tell the user to enter proper data if it
doesnot meet ur standards.
Thanks,
V
perhaps you need to make a high level internal decision in you're own
brain.. decide if the "text" is in fact text, or is it fragments of html
- decide which it is then treat it accordingly - if you decide it's html
then all you need to do is sanitize it and save it wherever (database,
flat files, anything); - note: i often think it's wise to save a plain
text version of all html fragments in addition, saves you repeating code
and is smaller if you want to save it in a fulltext indexed column (more
space in the db sicne two versions, but faster better indexes as only on
the plaintext)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php