Jump to content

Need to alter line of code that gets categories


zigojacko

Recommended Posts

Hey all,

 

I'm using the Featured Categories module by PrestaFABRIQUE.

 

I need to set individual styling to the featured categories on the homepage. There will only ever be three featured categories on the homepage, but each one needs to be styled separately (colour only that is).

 

The below is the code that inserts the featured categories on the homepage.

 


<ul class="clearfix">
   {foreach from=$categs item=c}
       <li> 
           {if array_key_exists("link_rewrite", $c)}
<a href="{$link->getCategoryLink($c.id, $c.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$c.name|escape:'htmlall':'UTF-8'}">{if $c.img != ""}<img src="{$categ_img_loc}{$c.img}-medium.jpg" />{/if}</a><br />
<a href="{$link->getCategoryLink($c.id, $c.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$c.name|escape:'htmlall':'UTF-8'}">{$c.name}</a> 
  {else}
<a href="{$link->getCategoryLink($c.id)|escape:'htmlall':'UTF-8'}" title="{$c.name|escape:'htmlall':'UTF-8'}">{if $c.img != ""}<img src="{$categ_img_loc}{$c.img}-medium.jpg" />{/if}</a><br />
<a href="{$link->getCategoryLink($c.id)|escape:'htmlall':'UTF-8'}" title="{$c.name|escape:'htmlall':'UTF-8'}">{$c.name}</a> 
  {/if}
       </li>
   {/foreach}
   </ul>

 

As you'll be able to see, the above gets all categories that are set to featured from the module configuration. I can't see a way I can style the categories individually like this.

 

What I'm needing is the ability to pull in a featured category within it's own <li> class so I can style them.

 

Can anyone advise of a way of doing this please?

 

Thanks in advance.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
<ul class="clearfix">
   {foreach from=$categs item=c}
    <li> 
	    <a href="{$link->getCategoryLink($c.id, $c.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$c.name|escape:'htmlall':'UTF-8'}">
  {if $lang_iso == "en"}
  <img src="{$categ_img_loc}{$c.img}-cathome-en.jpg" />
  {elseif $lang_iso == "fr"}
  <img src="{$categ_img_loc}{$c.img}-cathome-fr.jpg" />
  {else}
  <img src="{$categ_img_loc}{$c.img}-cathome.jpg" />
  {/if}
  </a><br />
    </li>
   {/foreach}
   </ul>

Link to comment
Share on other sites

<ul class="clearfix">
   {foreach from=$categs item=c}
    <li> 
	    <a href="{$link->getCategoryLink($c.id, $c.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$c.name|escape:'htmlall':'UTF-8'}">
  {if $lang_iso == "en"}
  <img src="{$categ_img_loc}{$c.img}-cathome-en.jpg" />
  {elseif $lang_iso == "fr"}
  <img src="{$categ_img_loc}{$c.img}-cathome-fr.jpg" />
  {else}
  <img src="{$categ_img_loc}{$c.img}-cathome.jpg" />
  {/if}
  </a><br />
    </li>
   {/foreach}
   </ul>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...