I've been working on formatting the home page of my classifieds without using the table columns. This way each category with subcategories can float in their own div...I'm finding this allows a cleaner look for what I'm after. I made the following change to the code on the home.tpl and was hoping someone could tell me if this is correct or needs some changes. It does look fine on the site. HTML: <table class="main" width="100%"> <tr> <th>{$smarty.const.LANG_BROWSE_CATEGORY}</th> </tr> <tr> <td valign="top"> {section name=tr loop=$data step=$cols} {section name=td start=$smarty.section.tr.index loop=$smarty.section.tr.index+$cols} <div class="categoryhome"> {if $data[td]<>""} {$data[td].start_link}<img src="{$data[td].image}" border="0" alt="{$data[td].name}" /></a> {$data[td].start_link}<strong>{$data[td].name}</strong></a> {if $data[td].total <> ''} ({$data[td].total}) {/if} {$data[td].subcats} {$data[td].description} {/if} </div> {/section} {/section} </td> </tr> </table>
It looks correct to me. Just from glancing at it you may want to put the categoryhome div inside the if($data[td']) just incase it is blank. But I think that is required.
The problem is does it look fine on various browsers. Does it validate as XHTML transitional The W3C Markup Validation Service. Posting a link would help to get more feedback.
So far my testing shows good browser compatability and it does validate as XHTML transitional Classifieds Site I haven't finished yet...but getting there...
Thanks...I hadn't tested on Safari. I did have to add a "display: inline" to the main div to fix an ie6 float problem...but other than that I'm pleased with the outcome. One problem with using floating divs for the category layout is that you have to watch the order in which they are placed....you have to make sure to keep the categories with the most subcategories to the left to have them fall into place nicely...
Would be nice if added to the script by default or make it possible to edit from templates, not healthy to modify core files, it makes upgrades more complicated ..
It is not a core file. He is putting this in a template folder - home.tpl . By all accounts you should copy the default template folder when you first install and call it something else. You then modify this new template folder with peace of mind. The documentation on how templates work is pretty clear. If a file exists in your new template folder it will be used but if it does not exist it will default to the DEFAULT. This way if you make a real hash of things you simply delete your version of the template file and it will pick up the default and bring you back to normal.
OK sorry, because there is a case where you have to edit some Categories.php file in order to display categories in a certain way. Is that possible through templates?
You should be able to handle this at the template level. I know when looking at index.php it collects the category details and send them off to the template home.tpl as an array. The template home.tpl loops over the array building table rows and cells so you would need to alter that to create divs instead of rows and cells.
I think this is not covered in the documentation... when I made those changes in the home.tpl file, all categories appears in a single column.
Normally the number of columns is controlled by your settings in admin. When you start hacking them up you run the risk of circumventing built in behaviour.
Take a look at your css and make sure that you set a width of each div that will allow for 3 columns and then make sure they float: left. That should do it...
I cannot find that information in the css file. Can you help me with this? Thank you for your patience.