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)
-   -   Where do I place something in the head tag of the home page? (https://forum.x-cart.com/showthread.php?t=59210)

imimin 05-04-2011 10:58 PM

Where do I place something in the head tag of the home page?
 
OK, I give up! I am using v4.4.2 and working with the 'fashion_mosaic_grey' template. I need to place some JS in the head of my homepage, but can't figure out which file to place it in! I tried the customer/home.tpl file on both the common files folder and the 'fashion_mosaic_grey' area, but does not show up on final home page output. I figured out where the actual display part goes (welcome.tpl) and it is working fine.

I am sorry if I sound like I am complaining, but I am about ready to pull my hair out trying to figure out all this basic file location stuff! Why does it have to be so complex to do something so simple?

Can someone please help me out!

THANK YOU!

qualiteam 05-04-2011 11:13 PM

Re: Where do I place something in the head tag of the home page?
 
Try disabling the "Do not check if templates are changed (Smarty compile_check)." option on the "General settings -> General options" page.

Also, try the "Webmaster mode" and "Firebug".

cflsystems 05-05-2011 02:45 AM

Re: Where do I place something in the head tag of the home page?
 
If still in development phase disable that option, you may also need for some template chages to appear to clear the cache - cleanup.php

DrQuietus 05-05-2011 03:03 AM

Re: Where do I place something in the head tag of the home page?
 
Add it to the bottom of /common_files/meta.tpl using an if statement

{if $main eq "catalog" and $current_category.category eq ""}
js
{/if}

This will only load it when on the homepage, I do this all the time for slideshows and such. Depending on the js, you could get conflicts.

imimin 05-05-2011 07:02 AM

Re: Where do I place something in the head tag of the home page?
 
Thanks guys! I got the JS to print to the head area.

I still have a problem (let me know if I should start another post?) I am in fact working on putting in a slide show on the home page of my site. My slide show is not working (had this code (similar) working in another (non-xcart) php site before). I think I have an issue with syntax in the .tpl file(s).

In the "fashion_mosaic_grey/customer/main/wecome.tpl" file I put the following table:

Code:

{*FOLLOWING IS FOR THE DYNAMIDRIVE FADE SLIDESHOW*}   
<table align='right' border="0" bordercolor="#fff" style="background-color:#fff" width="600" cellpadding="0" cellspacing="0">
<tr>
   
<td>
<div id="fadeshow1"></div>

<div id="fadeshow2"></div>

{*<div id="fadeshow2toggler" style="width:300px; text-align:center; margin-top:10px">
<a href="#" class="prev"><img src="http://i31.tinypic.com/302rn5v.png" style="border-width:0" /></a>  <span class="status" style="margin:0 50px; font-weight:bold"></span> <a href="#" class="next"><img src="http://i30.tinypic.com/lzkux.png" style="border-width:0" /></a>
</div>*}
</td>

</tr>
</table>
{*ABOVE IS FOR THE DYNAMIDRIVE FADE SLIDESHOW*}


and in the "common_files/customer/meta.tpl" file I put this at the end:

Code:

{if $main eq "catalog" and $current_category.category eq ""}
  {*BELOW CODE IS FOR THE DYNAMIC DRIVE SLIDE SHOW*}
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 
  <script type="text/javascript" src="fadeslideshow.js">
 
  /***********************************************
  * Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
  * This notice MUST stay intact for legal use
  * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
  ***********************************************/
 
  </script>
 
  <script type="text/javascript">
 
  var mygallery=new fadeSlideShow((
      wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
      dimensions: [300, 300], //width/height of gallery in pixels. Should reflect dimensions of largest image
      imagearray: [
          ["../../../images/Ztest/110115.jpg, "", "", ""],
          ["../../../images/Ztest/110825.jpg", "", "", ""],
          ["../../../images/Ztest/111225.jpg", "", "", ""] //<--no trailing comma after very last image element!
      ],
      displaymode: (type:'auto', pause:2500, cycles:0, wraparound:false),
      persist: false, //remember last viewed slide and recall within same session?
      fadeduration: 500, //transition duration (milliseconds)
      descreveal: "none"
  ))
 
 
  var mygallery2=new fadeSlideShow((
      wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
      dimensions: [300, 300], //width/height of gallery in pixels. Should reflect dimensions of largest image
      imagearray: [
          ["../../../images/Ztest/111476.jpg", "", "", ""],
          ["../../../images/Ztest/111512.jpg", "", "", ""],
          ["../../../images/Ztest/111848.jpg", "", "", ""] //<--no trailing comma after very last image element!
      ],
      displaymode: (type:'auto', pause:2500, cycles:0, wraparound:false),
      persist: false, //remember last viewed slide and recall within same session?
      fadeduration: 500, //transition duration (milliseconds)
      descreveal: "none"
  ))
 
  </script>
{*ABOVE CODE IS FOR THE DYNAMIC DRIVE SLIDE SHOW*}
{/if}


In the original code I found on DynamicDrive, there were brackets in place of the red and blue parenthesis in the second set of code above, but it didn't work (it didn't print the info between the brackets)(?maybe improper syntax for TPLs?) so I replaced with parenthesis which printed fine though I am not sure if the parenthesis work in the fadeshow code?

Any ideas on this on this? Maybe what I need to do is get the brackets to print in the head? If so, how?

Thank you!

cflsystems 05-05-2011 08:32 AM

Re: Where do I place something in the head tag of the home page?
 
surround the scripts with {literal} {/literal}

http://www.smarty.net/docs/en/language.function.literal.tpl

imimin 05-05-2011 09:02 AM

Re: Where do I place something in the head tag of the home page?
 
Thank you! That did the trick!


All times are GMT -8. The time now is 02:53 AM.

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