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)
-   -   Trouble with Random Image Generator in head.tpl (https://forum.x-cart.com/showthread.php?t=58644)

minfinger 03-27-2011 06:55 PM

Trouble with Random Image Generator in head.tpl
 
After upgrading to 4.4.2 from 4.3.2 I can't get my Image Generator to work.

Anyone have a clue here? I didn't have to put anything in the meta.tpl under 4.3.2 to get this to work before.

The original source of the code is from http://www.web-source.net/web_development/random_images.htm

Original head.tpl
Code:

{*
$Id: head.tpl,v 1.20 2009/06/05 11:46:27 joy Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
<div class="line1">
  {include file="customer/tabs.tpl"}
  <div class="logo1">
    <center>
    {literal}
<script type="text/javascript" language="JavaScript">
<!-- Copyright 2002 Bontrager Connection, LLC
//
// Type the number of images you are rotating.
NumberOfImagesToRotate = 5;
// Specify the first and last part of the image tag.
FirstPart = '<a href="home.php"><img src="skin1/flash/banner';
LastPart = '.jpg" height="192" width="1280" border="0"></a>';
function printImage() {
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + LastPart);
}
//-->
</script>
<script type="text/javascript" language="JavaScript"><!--
printImage();
//--></script>
{/literal}<br />
  </div>
  <script src="{$SkinDir}/hr.js" type="text/javascript"></script>
  {*<div class="logo">
    <div class="logo1">
      <a onclick="javascript: $('#hr_menu').hide();" href="{$catalogs.customer}/home.php"><img src="{$ImagesDir}/custom/company_logo.gif" alt="" /></a>
      <div class="logo2"><img src="{$ImagesDir}/spacer.gif" alt="" /></div>
    </div>
  </div>*}
  {*include file="customer/phones.tpl"*}
</div>
<div class="line2">
  {if $main ne "fast_lane_checkout"}
    {include file="customer/language_selector.tpl"}
  {else}
    {include file="modules/Fast_Lane_Checkout/head.tpl"}
  {/if}
</div>
{if $categories_menu_list}
  <div class="top-categories">
    <div class="hor-categories">
      <ul id="hr_list">
        {foreach from=$categories_menu_list item=c}
          <li><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category}</a></li>
        {/foreach}
      </ul>
    </div>
    <div class="more-categories" onmouseover="javascript: hrMenuShow('cat_list');" onmouseout="javascript: hrMenuHide('cat_list');">
      <a href="javascript:void(0);"><img id="menu_more" src="{$ImagesDir}/custom/menu_more.gif" alt="" /></a>
        <ul id="hr_menu" style="display: none;">
          <li>&nbsp;</li>
        </ul>
    </div>
  </div>
{/if}
{include file="customer/noscript.tpl"}


I do realize that " FirstPart = '<a href="home.php"><img src="skin1/flash/banner'; " needs to be changed to <img src="skin/common_files/flash/banner';

I also tried {$SkinDir}, but no go. I tried it in the meta.tpl as well, with and w/o the literal's

Thanks
Mike

minfinger 03-29-2011 08:05 PM

Re: Trouble with Random Image Generator in head.tpl
 
Nevermind, it started working. I have no idea.


All times are GMT -8. The time now is 02:06 PM.

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