/    Sign up×
Community /Pin to ProfileBookmark

I’m designing a website and I’m trying to make it completely tableless. Right now, I’m doing the following:

MySQL -> HTML (using only div tags) -> Styled using CSS

Basically, I’m using PHP to extract data from a MySQL database and creating pages which only use div tags. Each div tag is then associated with a style in my CSS file, making the site tableless.

I was discussing this with a friend, and he suggested I change the above model to:

MySQL -> XML – > HTML (using only div tags) -> Styled using CSS

He said I should extract the data using PHP from the database, but then create an XML file. Then, I should use XSLT to transform the file into HTML, and use the same styling technique to get the tableless layout.

My question is, does the extra step make sense? I can’t really see any benefit to this, looks to me like it’s just taking an extra step. What do you think?

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@schizoMar 22.2006 — The only real reason to use an XML intermediary here would be if your are publishing your content to multiple platforms (such as Web [i]and[/i] podcasting) or if you want others to feed off of your gathered data (like a blog for example).
Copy linkTweet thisAlerts:
@ThElInKauthorMar 22.2006 — The only real reason to use an XML intermediary here would be if your are publishing your content to multiple platforms (such as Web [i]and[/i] podcasting) or if you want others to feed off of your gathered data (like a blog for example).[/QUOTE]

Thanks Schizo. In my current website I use PHP to either generate HTML or RSS feeds - the data source is simply a database, rather than an XML file. If I use the new approach, I'll still end up writing an XSLT transformation for the HTML, and a different one for the RSS feeds.

Well, this being my blog I guess it's best to use the newest practices. I tried cooking something up but have encountered a problem.

For my blog page, I've written a PHP script which gets data from MySQL and outputs an XML file. Then from the XML file I link to the XSL stylesheet - but it does nothing with it. When I try to load my page, all I get is XML. Do I have to do something else apart from linking to the XSL to make the transformation actually happen?
Copy linkTweet thisAlerts:
@NogDogMar 22.2006 — XML is not better than HTML, it's just different. In this specific case, it seems like overkill to me: you have data in a MySQL database, which you want to extract via PHP and store in XML, which is essentially [i]another[/i] database. Then you want to use XSLT to transform it into HTML. This seems like double work (and thus double the chance for mistakes), when you can accomplish the same thing by just extracting from MySQL and going straight to HTML. But, since it's a personal site and as good an opportunity as any to play with new technologies, why not? ?

But theory aside, to go ahead with the XML process, you might need to add this header to your PHP script (before any output is generated):
[code=php]
header("Content-type: text/xml");
[/code]
×

Success!

Help @ThElInK spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...