Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,163,565 members, 7,854,421 topics. Date: Saturday, 08 June 2024 at 05:08 PM

Should Html Formatting Be In A Database? - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Should Html Formatting Be In A Database? (1079 Views)

I Need Steps To Creating A Database Using Wampserver / Save Facebook Comments Into A Database / Php/mysql. Does Every Php Script Need A Database? (2) (3) (4)

(1) (Reply) (Go Down)

Should Html Formatting Be In A Database? by yawatide(f): 1:38am On Sep 28, 2009
So recently, I had a go at it with the db guy at work over this. In the end, nothing changed short-term but I made my point and things will change long-term. I have decided to share this with you for discussion:

At work, we are deploying some new code next week and as always, the testers are going full blast. On one of the pages, we display an error message based on certain conditions. Let's say the text says, "hello world". In FF, the text shows up correctly but in IE, it shows up as "hello worldd (note the extra "d"wink. The defect was assigned to me.

First thing I did was look at the file. All it had was <%=error %> (We use JSP at work). So I determine that it is java-based. I get with the software guy but it isn't in there. We then go to the db guy. This is where I saw wonders. It had html tags, surrounding the actual error text. I then pasted the code in my text editor and validated it, only to find out that it was missing a closing SPAN tag. I tell the db guy to insert the SPAN tag to which he responds (most likely cos he doesn't want to "suffer" to insert it in his script), "add it after the error print statement. I got pissed. I was like, "since you are the one adding html formatting in the db, what's to say that tomorrow you won't screw up again, making my SPAN tag useless.? Besides, during my code review, most likely, the question will be asked, "why do you have <%=error%></span>? Why do you even have html and css in your db script? That is my domain".

As I said, he didn't want to do anything short-term but long-term, it was decided that yes, it doesn't make sense for the db guy to be doing my job, so to speak.

So the question (in case I am missing something), "other than for when you are developing a cms app, does it make sense to add html and css formatting into a table column? If no, why? If yes, why and give examples"

Let's discuss.
Re: Should Html Formatting Be In A Database? by kolitos007: 1:26pm On Sep 28, 2009
yawa-ti-de:

So recently, I had a go at it with the db guy at work over this. In the end, nothing changed short-term but I made my point and things will change long-term. I have decided to share this with you for discussion:

At work, we are deploying some new code next week and as always, the testers are going full blast. On one of the pages, we display an error message based on certain conditions. Let's say the text says, "hello world". In FF, the text shows up correctly but in IE, it shows up as "hello worldd (note the extra "d"wink. The defect was assigned to me.

First thing I did was look at the file. All it had was <%=error %> (We use JSP at work). So I determine that it is java-based. I get with the software guy but it isn't in there. We then go to the db guy. This is where I saw wonders. It had html tags, surrounding the actual error text. I then pasted the code in my text editor and validated it, only to find out that it was missing a closing SPAN tag. I tell the db guy to insert the SPAN tag to which he responds (most likely cos he doesn't want to "suffer" to insert it in his script), "add it after the error print statement. I got pissed. I was like, "since you are the one adding html formatting in the db, what's to say that tomorrow you won't screw up again, making my SPAN tag useless.? Besides, during my code review, most likely, the question will be asked, "why do you have <%=error%></span>? Why do you even have html and css in your db script? That is my domain".

As I said, he didn't want to do anything short-term but long-term, it was decided that yes, it doesn't make sense for the db guy to be doing my job, so to speak.

So the question (in case I am missing something), "other than for when you are developing a cms app, does it make sense to add html and css formatting into a table column? If no, why? If yes, why and give examples"

Let's discuss.



Interesting topic yawa, but I fail to understand your statement here, so am confused does it make sense to add html and css formatting into a table column?

Are you talkign about using either css or tables to create columns, the topic should html formatting be in a database, what are you trying to say? So many different things at the same time, undecided
Re: Should Html Formatting Be In A Database? by WebMonk(m): 2:06pm On Sep 28, 2009
It shouldn't. Not even the slightest "non belonging" slash grin. Defeats the goal of separating code from layout. But is damn-as-hell-convenient when done the first time. I've fumed over this in similar scenarios, CMSes in particular. At the very least, the top level elements should not be included in the Database.
Re: Should Html Formatting Be In A Database? by yawatide(f): 3:14pm On Sep 28, 2009
kolitos:
For the 3rd time, you fail to understand. I am beginning to think this is a trend and am considering not engaging in any thread for which you are a direct respondent. Obviously, I am not going crazy cos at least one person understands me and answered the question perfectly. Speaking of which:

webmonk:
Thank God you are still alive. I was beginning to get worried. Thanks for your input. You echoed my thoughts verbatim smiley

kolitos:
On second thoughts, I will attempt to make you understand:

Here is the code that was in the errors column:
<span><span><strong>you have reached this page in error</strong></span> - note the missing </span> tag

My point:
Why not just have the "you have reached this page in error" text in the appropriate column and let me determine, via html and css, how to best display this message (for example, to me the front end "skills" of the db guy, based on the html I just put up there, SUCK

Does this help, my dear friend? tongue
Re: Should Html Formatting Be In A Database? by Nobody: 3:28pm On Sep 28, 2009
@yawa, now i understand ur question.

depends on the situation at hand, if u have a site with a backend that enables admin to create html pages, then u have no option but to save your full html pages in ur DB. but if they wont be creating html pages, why save html in the DB?

as per the formatting issue, i think ur organization needs to google more, removing a "d" programmatically MAY break ur code when another upgrade comes out for ur platform (u know what i mean)
Re: Should Html Formatting Be In A Database? by yawatide(f): 3:34pm On Sep 28, 2009
webdezzi:

The "d" wasn't programmatically removed. The HTML was wrong (note the lack of a second </span> at the end). By adding the 2nd closing </span>, the "d" "disappeared" and the page is showing up correctly.

Thanks, and thanks for your input on when you may have no choice but to add html formatting to db table columns.
Re: Should Html Formatting Be In A Database? by Afam(m): 3:44pm On Sep 28, 2009
No. Because it simply does not make any sense. Presentation level work should be done by those that are well suited to do so.
Re: Should Html Formatting Be In A Database? by kolitos007: 4:47pm On Sep 28, 2009
Afam:

No. Because it simply does not make any sense. Presentation level work should be done by those that are well suited to do so.

Well said Afam, but to be honest, I don't think you will have any problems if you separate your code from html, maybe using smarty.
Re: Should Html Formatting Be In A Database? by nolongTing: 4:40pm On Sep 30, 2009
yawa-ti-de:

At work, we are deploying some new code next week and as always, the testers are going full blast.  On one of the pages, we display an error message based on certain conditions.  Let's say the text says, "hello world".  In FF, the text shows up  correctly but in IE, it shows up as "hello worldd (note the extra "d"wink.  The defect was assigned to me.

First thing I did was look at the file.  All it had was <%=error %> (We use JSP at work).  So I determine that it is java-based.  I get with the software guy but it isn't in there.  We then go to the db guy.  This is where I saw wonders.  It had html tags, surrounding the actual error text.  I then pasted the code in my text editor and validated it, only to find out that it was missing a closing SPAN tag.  I tell the db guy to insert the SPAN tag to which he responds (most likely cos he doesn't want to "suffer" to insert it in his script), "add it after the error print statement.  I got pissed.  I was like, "since you are the one adding html formatting in the db, what's to say that tomorrow you won't screw up again, making my SPAN tag useless.? Besides, during my code review, most likely, the question will be asked, "why do you have <%=error%></span>?  Why do you even have html and css in your db script?  That is my domain".

As I said, he didn't want to do anything short-term but long-term, it was decided that yes, it doesn't make sense for the db guy to be doing my job, so to speak.


1. Coding standards need to be established for every project in order to avoid this kind of uncertainty, where was your project manager?


yawa-ti-de:

So the question (in case I am missing something), "other than for when you are developing a cms app, does it make sense to add html and css formatting into a table column?  If no, why? If yes, why and give examples"

Let's discuss.



2.  html? YES if the data to be marked up is strictly presentation data;  for example populating a drop down list (<select>wink from the database with option groups.
     Css in a database NO!!!!!!!!!

3.  NO if the data is not presentation data; for example client details.
Re: Should Html Formatting Be In A Database? by hostmot(f): 12:54pm On Oct 01, 2009
There should be no reason why html formatting should take place in a database.

The database should be allowed to do what it knows how to do best; store and give data. It should not partake in the user interface process.

A company like yours should be using something like the MVC development pattern.

Html in the database will most definitely complicate things when you are trying to add ajax to spice things up.

Olawunmi,
Hostmot Sales Rep. (www.hostmot.com)
Re: Should Html Formatting Be In A Database? by WebMonk(m): 8:33am On Oct 02, 2009
^^@hostmot

Exellent contribution to the thread. Offtopic, besides using table-less format for your website, Commenting in your mother's tongue really has me inspired this early in the morning.
Re: Should Html Formatting Be In A Database? by yawatide(f): 3:21pm On Oct 02, 2009
hostmot: <!-- Ipari oke --> - he he tongue

nolongting:
I personally do not know of any deployment or testing that goes 100% smoothly, not to talk of a page that is coded the first time around being without at least 1 error. If you are aware, please let me know. I don't mind putting in a word or two for such a person and if necessary, have my employers sponsor the person's work visa tongue

On a more serious note though, all it was was an extra "d". The site still functions as designed. Is a typo bad? sure but it isn't the end of the world, compared to say, a blank page showing up.
Re: Should Html Formatting Be In A Database? by hostmot(f): 5:58pm On Oct 02, 2009
@webmonk

Its just the comments that you saw. You didnt notice the id attributes of the structural divs. It was done by our support guy. Thats our Bill Cosby.

@yawa-ti-de
You don't need to recommend that kinda coder to your company, Microsoft or Google would have snapped him up. smiley
Re: Should Html Formatting Be In A Database? by yawatide(f): 6:02pm On Oct 02, 2009
hostmot, tru dat  tongue

nolongting:
I missed the part of your post about coding standards. This is and should be within the domain of responsibility of the coders, not the project manager. It is the coder's manager that is and should be in charge of this. A PM, in an ideal company (not one where one is made to do everything including the kitchen sink) should only coordinate the different pieces of a project from an oversight level and not micromanage.
Re: Should Html Formatting Be In A Database? by askphantom(m): 11:50pm On Oct 02, 2009
No.

I believe all your formatting should be handled outside the db. This seperates content from design.

To start with, i might get entagled in a web just like you did and start editing my db when trying to fix it. You db is just meant to store information and display when and where needed. Your css decides how it should look like.

just my thoughts. grin
Re: Should Html Formatting Be In A Database? by yawatide(f): 12:55pm On Oct 03, 2009
all in all, these are excellent comments. In fact, ever since I started posting "non site review" posts, this is probably the best in terms of number of posts, quality of posts, the fact that there is no wrestlemania going on, etc. Please keep it up.

As I stated on the thread from cactus who would like to meet with his nigerian peers on october 10, I think the quality will get even better when we get to see each other face to face and get a personal feel for each other. Sometimes, though the answer (as in this case) is crystal clear, it is still good to hear from the other side, provided their arguments (again, as in this case) are sound and devoid of insults, egos, etc.

Again, please keep it up!
Re: Should Html Formatting Be In A Database? by OmniPotens(m): 7:25pm On Oct 03, 2009
I'm personally working out a small CMS application and I noticed that it is not really a nice option saving HTML tags to the DB because most times it conflicts with the HTML formatting on the web pages. Though I still think you could add them into posts body for formatting the texts. I said this based on my coding anyway. I used a simple textarea without any WYSIWYG editor integrated. But I'll try integrate one and see if there will be any difference.
Re: Should Html Formatting Be In A Database? by Nobody: 10:44pm On Oct 04, 2009
Now this is getting interesting. . .
Re: Should Html Formatting Be In A Database? by Holumighty(m): 4:48am On Oct 15, 2009
Please i need html and web design tutor.

(1) (Reply)

Which Should I Go For? / I'm In Need Of Execellent Web-designer / Need A Webhosting Site

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 62
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.