View Single Post
  #4  
Old 09-09-2014, 08:01 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Ui tabs different colour

Quote:
Originally Posted by Martin Bishop
I think I was hoping for a css trick/miracle but you've confirmed my thoughts, thanks
Well if you want a CSS miracle I think I can help. I didn't suggest this because it is not always supported by the browser, and its not really a scalable solution that will give you precise control.

You could try assigning the CSS you want using the last child psuedo selector. http://quirksmode.org/css/selectors/firstchild.html

You can also get some similar result using Javascript. http://stackoverflow.com/questions/1329841/changing-css-for-last-li

And finally you can do it with Smarty. http://www.smarty.net/forums/viewtopic.php?p=65372

Since this is X-cart 4 and we have Smarty, I would try that solution first.

Your template may be different, but mine is: /ideal_responsive/customer/main/ui_tabs.tpl

I see this code:
Code:
<ul> {foreach from=$tabs item=tab key=ind} {inc value=$ind assign="ti"} <li><a href="{if $tab.url}{$tab.url|amp}{else}#{$prefix}{$tab.anchor|default:$ti}{/if}">{$tab.title|wm_remove|escape}</a></li> {/foreach} </ul>
We need to give the foreach loop a name "product_tabs", then we can use the if statment.

Code:
<ul> {foreach from=$tabs item=tab key=ind name=product_tabs} {inc value=$ind assign="ti"} <li{if $smarty.foreach.product_tabs.last} class="last_tab"{/if}><a href="{if $tab.url}{$tab.url|amp}{else}#{$prefix}{$tab.anchor|default:$ti}{/if}">{$tab.title|wm_remove|escape}</a></li> {/foreach} </ul>

You can see it working fine on my test site: http://trainingpen.com/product.php?productid=17515 -warning this site gets reloaded frequently, example might not exist in the future.

So I didn't suggest this because I was thinking that it would only work for first or last, but now that I think more about it, you could assign any color to any tab you want this way, based on the index of the foreach loop. Sorry I didn't see this immediately, and worried you unnecessarily.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote