Page 1 of 1

PHP & CSS Vs. PHP + tables

Posted: Thu Nov 09, 2006 12:42 pm
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

Posted: Thu Nov 09, 2006 1:24 pm
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.

Posted: Thu Nov 09, 2006 4:24 pm
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.

Posted: Thu Nov 09, 2006 6:27 pm
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.

Posted: Fri Nov 10, 2006 12:53 am
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.

thanks

Posted: Mon Nov 13, 2006 9:49 am
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