X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   FREE Banner Rotator with Links (https://forum.x-cart.com/showthread.php?t=52351)

Dan.roh 10-10-2010 12:03 AM

Re: FREE Banner Rotator with Links
 
For some reason the code will not work if you have any other Java script on the same page as they seem to conflict with each other.

Secondly, what I did was to create a language variable and then place the code in the variable and then just call the variable where you want the banner rotator to display

Create a variable lbl_banner_rotator

Place the below code where you want the banner rotator to display

{$lng.lbl_banner_rotator}


Also ensure that your image path ways are specified correctly

bellabeachwear 10-10-2010 02:35 AM

Re: FREE Banner Rotator with Links
 
I created a language variable and added the {$lng.lbl_banner_rotator} to my welcome.tpl. it shows on my page source, but does not work. may be because i have other JS on the same page...

:-(

Dan.roh 10-10-2010 02:46 AM

Re: FREE Banner Rotator with Links
 
Try to put {$lng.lbl_banner_rotator} on another page just to check if it works, even if you have to create a temp static page just for testing purposes. If it does then it confirms that you had conflict with other JS. If it still not working then your issue lies elsewhere

bellabeachwear 10-10-2010 02:52 AM

Re: FREE Banner Rotator with Links
 
I tried into another static page and still does not work. I added a text label before just to see if it shows on the static page and it does show, but it does not show the images after the text...

Dan.roh 10-10-2010 08:02 AM

Re: FREE Banner Rotator with Links
 
Try to put the full code not {$lng.lbl_banner_rotator} in a static page and if it still does not work then it is definitely a conflict with JS

bellabeachwear 10-11-2010 05:54 AM

Re: FREE Banner Rotator with Links
 
Quote:

Originally Posted by Dan.roh
Hi Guys,

I found this very useful banner rotator online and thought the right thing to do would be to share it.

Useful things about this banner rotator:

- Your banners do not all have to be the same size as it allows you to specify a background and you can set the background to be the size of your largest banner.
- You can have as many banners as you like and you can specify where they link to.
- You can set the cycles of your rotator for as many times as you want or you can just set it continuous.
- You can set the rotator to randomize your banners or have them display in order.
- You can also set the time before the next banner must display.
- You can set it to pre-load all your banners or not.


**Hope someone would find this useful, you can display it anywhere on your site or even within a language variable.

Interesting, the whole reason the code was not working was a typo in the word "length". there was a space between the t and the h...

:-).

Now it works.

BTW. MUST Install in the welcome.tpl or any other tpl file. not in the language section

Dan.roh 10-18-2010 09:25 AM

Re: FREE Banner Rotator with Links
 
Well spotted! I have tried to edit my post but the WYSIWYG editor in this forum displays it without the space. Not sure I understand why this space appears.

A forum moderator should maybe look into this?

MAPerformance 10-26-2010 11:48 AM

Re: FREE Banner Rotator with Links
 
Got this working using your language variable idea, and removing the space in "length" :)

Thanks for this!

Dan.roh 10-26-2010 12:13 PM

Re: FREE Banner Rotator with Links
 
Glad you are sorted! Like your site by the way, looking good!

BellaBeachwear spotted the space in "length", although I did try and edit my post to fix it but the WYSIWYG in this forum is not having it for some reason?

Regarding language variables, I always try and test most code in them first because it makes it so much easier to modify things. You will notice that they are handy for allot of things e.g. if you look on my site you will see on my left and right hand side columns I have a string of banners. These banners are placed in 2 language variables, one named lbl_left_column and lbl_right_column. This makes life so much easier if you wish to change your banners because instead of trying to remember which tpl to edit you just keep record of all your language variables and BOB's YOUR UNCLE!

cmarrese 11-10-2010 08:57 AM

Re: FREE Banner Rotator with Links
 
Dan,

I tried the code (fixing the space in length issue) and placed it on a static page to get it working before I add it to my welcom page, but I consisatntly get a syntax error in the same spot.

In the code I have (as per youtr post):
if (preloadimages=="yes"){
for (i=0;i<ultimateshow.length;i++){
var cacheimage=new Image()
cacheimage.src=ultimateshow[i][0]
}
}
var currentslide=0
function randomize(targetarray){
ultimateshowCopy=new Array()
var the_one
var z=0
while (z<targetarray.length){
the_one=Math.floor(Math.random()*targetarray.lengt h)
if (targetarray[the_one]!="_selected!"){
ultimateshowCopy[z]=targetarray[the_one]
targetarray[the_one]="_selected!"
z++
}
}
}

But in the source code when the page loads all it has is:
if (preloadimages=="yes")}
var currentslide=0
function randomize(targetarray)
}
}
Which the creates a syntax error on floating "}". I have tried retyping these sections add, subtracting, etc. But still nothing is showing up in the source code.

Have you seen anything like this before or have any ideas?

Thanks
Chris


All times are GMT -8. The time now is 07:31 PM.

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