PHP & CSS Vs. PHP + tables

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
sambkk
Forum Newbie
Posts: 9
Joined: Sun Sep 17, 2006 1:45 pm

PHP & CSS Vs. PHP + tables

Post by sambkk »

Hi All
I need to build a site that will have a database with some php code handling all the work.
The layout will be based on a design of the companys print catalog.
And the Print design isnt ready. So I need to start working on the php code already.
I was thinking of whipping together a site in dreamweaver with some tables etc just to place all the elements and links and so on, and then have someone write the php code I need.I would then test the system and later as the design is ready, layout the actual site with css, then have the coder attach the code tto the new site.
Can anyone estimate is that a method that will end up wasting time and effort as the eventual site will be done in css with no tables if possible?
I mean I understand that some php code will surely have to look different but how big will the difference be, wil it be worth it?

I would appreciate any advice.

Thanks

Sami
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

If it were me, I'd test with div tags. I'd use table tags if what I was displaying was "tabular data". CSS still cannot compete with tables when display this kind of data. Yes replacing HTML later is a real PITA especially if you are mixing PHP and HTML.
alvinphp
Forum Contributor
Posts: 380
Joined: Wed Sep 21, 2005 11:47 am

Post by alvinphp »

CSS Divs can't compete with tables where you need your site perfect to the pixel on all major browsers. The problem with CSS is that does not do the same thing on all browsers which is why so many people revert back to tables and css versus divs and css.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Write your PHP as though there were no markup involved. Set vars, etc, but don't code a thing that renders yet.

Then write your markup as though it were static. After both are done, put them together. Code first, then markup, using the markup to show what your code has done by strategically placed <?php echo $thesevars; ?> throughout as needed.
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

I agree with Everah. Let the backend spit out only the necessary markup. If any. Then in the templates you only have to include the vars or loop through a resultset and surround it with markup.

If in some cases you'd want to let the PHP produce markup, I would keep it to a minimum and definitely not use tables. Tables are rigid and cannot be changed in the design. On the other side, a simple <ul> or some divs can be designed in any way with the css.

For example if you'd want to show a list of the main categories on your site. Let the PHP produce a <ul class="catlist"> and you or the designer can design it any way you want.
sambkk
Forum Newbie
Posts: 9
Joined: Sun Sep 17, 2006 1:45 pm

thanks

Post by sambkk »

hi guys
thanks for all the comments and valid advice
I think I will keep tables to a minimum.

all the best sami
Post Reply