Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

is it good practice to edit the index.php code and convert any tables to css?


vampirehunter

Recommended Posts

was wondering if anyone can advise.

 

is it good practice to edit the index.php code and convert the category listing code's output?

 

since the categories are output using tables, and i am changing them to div tags, is this considered good practice or bad?

 

should i just leave the table format alone?

 

ive managed to change the category listing so it displays in div tags and i can still use the admin to decide how many categories per row and it seems to work fine.

Link to comment
Share on other sites

Subcategories are listed in table mode and there is nothing bad with this.

 

Nobody says that tables should disappear completely from websites

 

You can however change this to divs, I would say better to an unordered list, if it gives a better result for you

Link to comment
Share on other sites

yes multimixer, thats what ive done.

 

ive changed the categories and subcategories from table to unordered list.

 

so now mine has this

 

while ($categories = tep_db_fetch_array($categories_query)) {
  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
  echo '	    <ul class="catlisting"><li class="categoryname"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] .   '</li><li class="categoryimg">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a></li></ul>' . "\n";
  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
    echo  "\n";
    echo  '<br />';
  }
   }

 

i just found that with an unordered list inside a div, i could organise the layout a little easier.

even though i am not a anti table person. i just found it difficult to arrange my desired layout using that table code.

 

with the ul and li tags, it seems easier, and i can go to css and line things up.

 

for SEO, will it make any difference whether table or ul, li tags are used? particularly for this bit?

 

im going to be doing the same for the actual product listing page too, as i need a particular type of layout.

Link to comment
Share on other sites

The way you have it now, you create an <ul></ul> for each category, I don't think that is necessary, and it is not exactly the meaning of creating a list

 

In other words, you have now a list for each category, placing the lists side by side, not optimal in my opinion

 

Why not have everything wrapped into one <ul></ul> and then each category into a <li> ? Content of the <li> can be anything then

Link to comment
Share on other sites

The way you have it now, you create an <ul></ul> for each category, I don't think that is necessary, and it is not exactly the meaning of creating a list

 

In other words, you have now a list for each category, placing the lists side by side, not optimal in my opinion

 

Why not have everything wrapped into one <ul></ul> and then each category into a <li> ? Content of the <li> can be anything then

 

the thing is

 

if i make all the content into li tags. then i will have an image in a li tag, then text in a li tag. i dont know how to align the text li tag ontop of the images li tag.

 

what do you suggest for this?

Link to comment
Share on other sites

If the data presentation naturally falls into an M row x N column grid, by all means use a table. That's what it's there for in HTML. For an M row x 1 column layout, a list may be better. Just don't fall into the trap of desperately trying to get rid of all tables because some self-annoited expert told you that tables are poison.

 

The whole anti-table backlash came about because in the early days of HTML, there was no CSS. The only way to precisely control a page's layout was to nest tables within tables within tables... There's no excuse for doing that now that we have CSS. However, naturally tabular layouts can certainly continue to use tables. There's nothing wrong with that!

Link to comment
Share on other sites

If the data presentation naturally falls into an M row x N column grid, by all means use a table. That's what it's there for in HTML. For an M row x 1 column layout, a list may be better. Just don't fall into the trap of desperately trying to get rid of all tables because some self-annoited expert told you that tables are poison.

 

The whole anti-table backlash came about because in the early days of HTML, there was no CSS. The only way to precisely control a page's layout was to nest tables within tables within tables... There's no excuse for doing that now that we have CSS. However, naturally tabular layouts can certainly continue to use tables. There's nothing wrong with that!

 

I agree DrPhill, i find the anti tables stuff hilarious sometimes.

 

there's even a website dedicated to css vs tables. (w00t)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...