View Single Post
  #73  
Old 03-28-2008, 01:06 AM
  DrQuietus's Avatar 
DrQuietus DrQuietus is offline
 

Advanced Member
  
Join Date: Dec 2005
Posts: 81
 

Default Show categories on welcome.tpl - after the mod on this thread is installed

My client wanted the categories listed on the home page with custom icons. I already had the show subcategories only for the current category mod installed. I copied the categories.tpl and named it categories-home.tpl, trimmed it down a bit, and put an if statement on the main categories list item to display the different icons. Just thought I would post it because it is an easy way to add the categories to welcome.tpl if you already have the mod in this thread installed. For version 4.1.x

categories-home.tpl - You would obviously have to change the categoryid numbers to suit your project, and it could get out of control if you have a lot of categories:

Code:
{if $config.General.root_categories eq "Y"} <ul id="homecats"> {foreach from=$categories item=c} <li {if $c.categoryid eq "10"}id="pressure"{elseif $c.categoryid eq "12"} id="electrical"{elseif $c.categoryid eq "19"}id="temp"{elseif $c.categoryid eq "24"} id="humidity"{elseif $c.categoryid eq "26"} id="air"{elseif $c.categoryid eq "28"}id="light"{/if}><a class="mainhomecats" href="home.php?cat={$c.categoryid}">{$c.category}</a> <ul> {assign var=in value=$c.categoryid} {foreach from=$allsubcategories.$in item=c } <li><a class="subhomecats" href="home.php?cat={$c.categoryid}">{$c.category}</a></li> {/foreach} </ul> </li> {/foreach} </ul> {/if}

welcome.tpl add the following line:
Code:
{include file="customer/categories-home.tpl"}




CSS (could be a bit more trim - but this is easy to follow):
Code:
ul#homecats { margin: 0px; padding: 0px; list-style-type: none; text-align: left; padding-left: 15px; } ul#homecats li#pressure, ul#homecats li#electrical, ul#homecats li#temp, ul#homecats li#humidity, ul#homecats li#air, ul#homecats li#light { width: 250px; float: left; display: block; height: 180px; margin-left: 10px; } ul#homecats li#pressure { background: url(images/pressure.gif) no-repeat left top; } ul#homecats li#electrical { background: url(images/electric.gif) no-repeat left top; } ul#homecats li#temp { background: url(images/temp.gif) no-repeat left top; height: 130px; } ul#homecats li#humidity { background: url(images/humidity.gif) no-repeat left top; height: 130px; } ul#homecats li#air { background: url(images/air.gif) no-repeat left top; height: 130px; } ul#homecats li#light { background: url(images/light.gif) no-repeat left top; height: 130px; } ul#homecats a.mainhomecats { display: block; color: #1c1d47; padding-left: 50px; padding-top: 24px; padding-bottom: 5px; font-size: 16px; font-weight: normal; text-align: left; border-bottom: 1px solid #1c1d47; } ul#homecats a.mainhomecats:hover { text-decoration: none; color: #471d1d; } ul#homecats ul { margin: 0px; padding: 0px; padding-top: 5px; list-style-type: none; } ul#homecats ul a.subhomecats { } ul#homecats ul a.subhomecats:hover { }

final result: http://www.tek-inst.com/
__________________
Dave Jones
dave@industrialwebworks.net
Mostly 4.7.2 - 4.7.5
Reply With Quote