Thread: Button Template
View Single Post
  #1  
Old 08-05-2005, 12:26 PM
 
cgrant cgrant is offline
 

Member
  
Join Date: Feb 2005
Posts: 26
 

Default Button Template

So I was making a new button for x-cart, to replace the buy now one that came with one of the skins we picked up. I was aware that it was broken into 3 images, what I was not aware of is how bloated the code was for a freakin button!


Code:
{* $Id: button.tpl,v 1.16.2.1 2004/11/01 07:33:15 max Exp $ *} {if $config.Adaptives.platform eq 'MacPPC' && $config.Adaptives.browser eq 'NN'}{assign var="js_to_href" value="Y"}{/if} {if $type eq 'input'}{assign var="img_type" value='INPUT type="image"'}{else}{assign var="img_type" value='IMG'}{/if} {assign var="js_link" value=$href|regex_replace:"/^\s*javascript\s*:/Si":""} {if $js_link eq $href}{assign var="js_link" value="javascript: self.location='`$href`'"} {else}{assign var="js_link" value=$href}{if $js_to_href ne 'Y'}{assign var="onclick" value=$href}{assign var="href" value="javascript: void(0);"}{/if}{/if} {if $style eq 'button' && ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')} <TABLE border="0" cellspacing="0" cellpadding="0" onclick="{$js_link}" style="cursor: pointer;" valign="middle"{if $title ne ''} title="{$title}"{/if}> <TR><TD><{$img_type} src="{$ImagesDir}/{if $usertype eq "C"}custom/but1.gif" width="7" heigth="17"{else}but1.gif" width="7" height="14"{/if} border="0"{if $title ne ''} title="{$title}"{/if}></TD> <TD class="Button" valign="middle" nowrap>{$button_title}</TD> <TD>[img]{$ImagesDir}/{if $usertype eq [/img]</TD></TR> </TABLE> {else} <FONT class="FormButton">{$button_title} <{$img_type} {include file="buttons/go_image.tpl" full_url='Y'}></FONT> {/if}

Now I was able to replace the Speed Bar and the Category list with CSS driven divs and lists and they load much faster, but I look at this and my head starts to hurt. I know php, mysql, css and html, but ive never really touched java, could someone give me a quick explanation of what the java is doing in this case? and why there is a call to go_image.tpl?
__________________
X-CART 4.0.12 Gold
Robotnik.com *LIVE SITE
Reply With Quote