X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Need code help. jQuery banner to home page only. (https://forum.x-cart.com/showthread.php?t=74293)

Katsu 08-09-2016 07:02 AM

Need code help. jQuery banner to home page only.
 
I installed a third-party jquery banner but it appears on all pages. I need it to appear on the home page only. I believe I need to add an 'if' statement to /light_responsive/customer/home.tpl. The div class should be wrapped with a smarty snippet:
{if $main eq "catalog" and $current_category.category eq ""}

{/if}
I don't know what to code to enter between the {if ...} and {/if} statements.


Any help is much appreciated.

cherie 08-09-2016 04:15 PM

Re: Need code help. jQuery banner to home page only.
 
Your code looks good. Add the the banner code in between. However, you might want to just put it in welcome.tpl or home_page_banner.tpl without the need for the if statement.

Katsu 08-09-2016 11:56 PM

Re: Need code help. jQuery banner to home page only.
 
Thank you Cherie. That does seem to make sense. Any chance you could point me to the correct spot to insert my banner code?

/light_responsive/customer/main/home_page_banner.tpl:


*}
{if $active_modules.Banner_System and $top_banners ne ''}
{include file="modules/Banner_System/banner_rotator.tpl" banners=$top_banners banner_location='T'}
{elseif $active_modules.Demo_Mode and $active_modules.Banner_System}
{include file="modules/Demo_Mode/banners.tpl"}
{else}
<div class="welcome-img">
<a href="http://www.x-cart.com" target="_blank"><img src="{$AltImagesDir}/custom/welcome_picture.jpg" alt="X-Cart" title="" /></a>
</div>
{/if}

seyfin 08-10-2016 01:49 AM

Re: Need code help. jQuery banner to home page only.
 
As I can see, the banner code begins with these lines:

Quote:

<!-- ZOOM SLIDER HTML CONTENT START -->
<div id="bannerscollection_zoominout_21">


and ends with these lines:

Quote:

</div>
<p style="margin:0;padding:0;">&nbsp;</p>
<!-- ZOOM SLIDER HTML CONTENT END -->


So, if you need the banners to appear on the home page only, your code should be wrapped with the {if} ... {/if} smarty snippet - see example below:

Quote:

{if $main eq "catalog" and $current_category.category eq ""}
<!-- ZOOM SLIDER HTML CONTENT START -->
<div id="bannerscollection_zoominout_21">

... some skipped banner code ....

</div>
<p style="margin:0;padding:0;">&nbsp;</p>
<!-- ZOOM SLIDER HTML CONTENT END -->
{/if}


cherie 08-10-2016 01:00 PM

Re: Need code help. jQuery banner to home page only.
 
I would put it within the else/last section:
PHP Code:

{else}
{*
<
div class="welcome-img">
<
a href="http://www.x-cart.com" target="_blank"><img src="{$AltImagesDir}/custom/welcome_picture.jpg" alt="X-Cart" title="" /></a>
</
div>
*}
<!-- 
ZOOM SLIDER HTML CONTENT START -->
<
div id="bannerscollection_zoominout_21">

... 
some skipped banner code ....

</
div>
<
p style="margin:0;padding:0;">&nbsp;</p>
<!-- 
ZOOM SLIDER HTML CONTENT END -->

{/if} 


Katsu 08-15-2016 02:24 AM

Re: Need code help. jQuery banner to home page only.
 
That fixed it. Thank you Sergey. Thank you Cherie.


All times are GMT -8. The time now is 07:28 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.