osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

ADDING JAVASCRIPT with PHP???

This is a discussion on ADDING JAVASCRIPT with PHP??? within the osCMax v1.7 General Mods Discussion forums, part of the osCMax v1.7 Forums category; I am trying to add this on my Front Page and am having trouble on where to place the particular ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 General Mods Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 01-03-2007, 03:38 PM
Lurker
 
Join Date: Dec 2006
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
tonitonitoni2 is on a distinguished road
Default ADDING JAVASCRIPT with PHP???

I am trying to add this on my Front Page and am having trouble on where to place the particular code?? Am I supposed to put this in application_top or includes/languages/english/index.php??

Random Images from a Directory Using PHP

Any help is greatly appreciated.

Thanks!

Toni
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 01-03-2007, 04:42 PM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,190
Thanks: 66
Thanked 290 Times in 276 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Cool Re: ADDING JAVASCRIPT with PHP???

In osCMax v1.7, this code goes in the <head> section of your template's main_page.tpl.php:

HTML Code:
<script src="js/dw_rotator.js" type="text/javascript"></script> <script src="js/dw_random.js" type="text/javascript"></script>
You can decide how best to include the php functions (either write create your own file or include it in application_top.php to make it available on any page).

And the final bit of code would go on the actual template page where you want it to display:

PHP Code:
<?php if ( $image_list getImagesList($path_to_images) ) : ?>

<script type="text/javascript">
/*************************************************************************
    This code is from Dynamic Web Coding at dyn-web.com
    Copyright 2001-5 by Sharon Paine 
    See Terms of Use at dyn-web.com/bus/terms.html
    regarding conditions under which you may use this code.
    This notice must be retained in the code as is!
    
    See full source code at dyn-web.com/scripts/rotate-rand/
*************************************************************************/
var imgList = [
  <?php echo getJSRandomized($path_to_images$image_list$num_to_rotate); ?>
  ];
var rotator1 = new dw_RandRotator(4000); // rotation speed
// images array, width and height of images, transition filter (boolean)
rotator1.setUpImage(imgList, null, null, false);
</script>

<?php else : ?>
<!-- image to display if directory listing fails -->
<img src="images/smile.gif" width="88" height="88" alt="">

<script type="text/javascript">dw_Rotator.start = function() {};</script>

<?php endif; ?>
__________________
Michael Sasek
osCMax Developer


osCMax Templates - Hundreds of premium quality templates. New designs every month!

xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience


osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 01-03-2007, 05:20 PM
Lurker
 
Join Date: Dec 2006
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
tonitonitoni2 is on a distinguished road
Default Re: ADDING JAVASCRIPT with PHP???

Ok, I must just be a spaz. I have tried the above and all I get on the main page is a red x.

osCMax v2.0

Any suggestions??

Thanks Michael for your quick reply.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 01-05-2007, 06:23 AM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,190
Thanks: 66
Thanked 290 Times in 276 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
Default Re: ADDING JAVASCRIPT with PHP???

The img src is showing up as variables so I think you need to make sure you have everything installed correctly.

Also, my javascript console is showing these errors:

Error: dw_RandRotator is not defined
Source File: osCMax v2.0
Line: 14

I think you forgot to add something somewhere...or have the incorrect path to your php functions maybe

Oh, and instead of saying thanks, click the Thanks! button in my post
__________________
Michael Sasek
osCMax Developer


osCMax Templates - Hundreds of premium quality templates. New designs every month!

xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience


osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
The Following User Says Thank You to michael_s For This Useful Post:
tonitonitoni2 (01-05-2007)
  #5  
Old 01-05-2007, 06:28 AM
Lurker
 
Join Date: Dec 2006
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
tonitonitoni2 is on a distinguished road
Default Re: ADDING JAVASCRIPT with PHP???

Thanks Michael. I will try messing with it some more.

OH, where would I put the <body onload="dw_Rotator.start()">

in application_top or main_page.tpl.php?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread



Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Javascript Error cherven osCMax v2 Installation issues 2 02-04-2007 11:30 PM
Javascript & BTS gamerigs osCMax v2 Customization/Mods 2 11-06-2005 12:20 PM
Bizrate Javascript Code Anonymous osCMax v1.7 Discussion 0 11-08-2003 04:19 AM
Javascript Error jgkiefer osCMax v1.7 Discussion 0 09-23-2003 05:55 AM
javascript integration bushman osCMax v1.7 Discussion 3 09-16-2003 10:12 AM


All times are GMT -8. The time now is 04:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
Copyright 2008 osCMax