osCmax v2.5 User Manual
Results 1 to 5 of 5

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 ...

      
  1. #1
    Lurker
    Join Date
    Dec 2006
    Posts
    4
    Rep Power
    0


    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

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    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 Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    Lurker
    Join Date
    Dec 2006
    Posts
    4
    Rep Power
    0


    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.

  4. #4
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    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 Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  5. #5
    Lurker
    Join Date
    Dec 2006
    Posts
    4
    Rep Power
    0


    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?

Similar Threads

  1. Javascript Error
    By cherven in forum osCmax v2 Installation issues
    Replies: 2
    Last Post: 02-04-2007, 10:30 PM
  2. Javascript & BTS
    By gamerigs in forum osCmax v2 Customization/Mods
    Replies: 2
    Last Post: 11-06-2005, 11:20 AM
  3. Bizrate Javascript Code
    By Anonymous in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 11-08-2003, 03:19 AM
  4. Javascript Error
    By jgkiefer in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 09-23-2003, 05:55 AM
  5. javascript integration
    By bushman in forum osCmax v1.7 Discussion
    Replies: 3
    Last Post: 09-16-2003, 10:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •