View Single Post
  #1  
Old 03-07-2009, 06:27 AM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Thumbs up AJAX based flash/gif banner rotetor

Guys,
Since many days I was looking for banner system for x-cart which should support flash. I tried many free php scripts but non of them worked with flash support in x-cart.

I found open source ajax based javascript from dynamicdrive.com ( http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm ) which runs fine in x-cart to display banners & good thing is that as it's ajax based the new flash/gif banners are loaded without page refresh as per time set by you.

Following steps I did & manage to display banners in my x-cart's main page (welcome.tpl)

Step1
----------
create folder "flash" in skin1 directory

Open home.tpl & enter following code just before </head> tag
Code:
<script src="/your-store-directory/skin1/flash/ajaxticker.js" type="text/javascript"> /*********************************************** * Ajax Ticker script (txt file source)- ╘ Dynamic Drive (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit http://www.dynamicdrive.com/ for this script and 100s more. ***********************************************/ </script>
Note: you can put ajaxticker.js on any directory on your sever. But make sure you give proper path on above code.

Step2 (optional)
----------
Open Skin1.css & at end put
Code:
/#ajaxticker1{ width: 466px; height: 60px; border: 1px ridge black; padding: 5px; background-color: #FEEEB8; } #ajaxticker1 div{ /*IE6 bug fix when text is bold and fade effect (alpha filter) is enabled. Style inner DIV with same color as outer DIV*/ background-color: #FEEEB8; } .someclass{ //class to apply to your scroller(s) if desired }

Note: you need to follow above step if you want to run this as ticker system & not banner roteting system. Don't forget to define width & height as per your requirement

Step3
----------
Open welcome.tpl & after the tag {$lng.txt_welcome} paste
Code:
{literal}<script type="text/javascript"> var xmlfile="/your-store-directory/skin1/flash/tickercontent.txt" //path to ticker txt file on your server. //ajax_ticker(xmlfile, divId, divClass, delay, optionalfadeornot) new ajax_ticker(xmlfile, "ajaxticker1", "someclass", 25000, "fade") </script>{/literal}
Note: you can increase/decrease value of default time "25000" as per your need to load next banner
Step 4
------------
Save ajaxticker.js file & tickercontent.txt files in the folder skin1/flash/ folder

Step 5
----------
I have put 2 sample flash banners code in file tickercontent.txt. You should place your flash banner code between tag <div class="message"> </div>. You can save your swf files in skin1/flash folder or any directory at your web site but make sure to give proper path else banner will not display.

For more info about how exatly above code works please visit http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm

I have not tried but I guess you can display random products also using this code.

Any idea from other members to improve this code is always welcome
Attached Files
File Type: zip ajaxticker.js.zip (2.0 KB, 208 views)
File Type: txt tickercontent.txt (1.3 KB, 160 views)
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote