Announcement

Collapse
No announcement yet.

Yahoosections and dynamic image changing with javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Yahoosections and dynamic image changing with javascript

    Hi I was wondering whether it was possible to use the YahooSections function to return / echo a set of variables, which are picked up by a dynamic image changer such as the one on dyn-web..

    http://www.dyn-web.com/code/rotate_i...ate_random.php

    I have made a start with the variables, but I can't seem to get them to load into the dynamic image code from dyn-web. It would make a very nice feature to have a dynamically changing image that refers to the current section images.

    In <HEAD>

    Code:
    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    
    function YahooSections(ar)
    {
    var strIms = "[";
    var strUrls = "[";
    var stralt = "[";
    
    for (var i=1;i<=ar.length;i++)
      {
      if (ar[i].sURL != null)
        {
        strIms += '"' + ar[i].sImage + '"' + ',';
        strUrls += '"' + ar[i].sURL + '"' + ',';
        stralt += '"' + ar[i].sName + '"' + ',';
    		{
          if (ar[i].pChild)
            {
            for (var j=1;j<=ar[i].pChild.length;j++)
              {
              if (ar[i].pChild[j].sURL != null)
    		{
    		strIms += '"' +ar[i].pChild[j].sImage + '"'+ ',';
    		strUrls += '"' + ar[i].pChild[j].sURL + '"' + ',';
    		stralt += '"' + ar[i].pChild[j].sName + '"' + ',';								{
    		if (ar[i].pChild[j].pChild)
    							{
    								for (var k=1;k<=ar[i].pChild[j].pChild.length;k++)
    								{
    									if (ar[i].pChild[j].pChild[k].sURL != null)
    										{	
    									strIms +=  '"' +ar[i].pChild[j].pChild[k].sImage + '"' + ',';			strUrls += '"' + ar[i].pChild[j].pChild[k].sURL + '"' + ',';			stralt += '"' + ar[i].pChild[j].pChild[k].sName + '"' + ',';
    								}
    							}	
    					
    					}
    				}
              }
            }
          }
    }
    strIms += "]" ;
    strUrls += "]" ;
    stralt += "]" ;
    }
    }
    }
    var rotator1 = {
        path: '/', 
        speed:  3000, // default is 4500
        id: 'r1',
        bTrans: true,
        bMouse: true,
        bRand:  true,
        images: return strIms
        actions: return strUrls
        title: return stralt
    
    	}
    
    function initRotator() {
        dw_Rotator.setup(rotator1);
    }
    
    dw_Event.add( window, 'load', initRotator);
    
    </script>

    In <BODY>

    Code:
    <a href="index.html"><img id="r1" src="smile.gif" alt="" title="That's a nice smile!" border="0"></a>

    Is there a way of passing the variables using php??


    Please help

    #2
    Using the Actinic section tree structure is hard work.

    Look in the Advanced Guide for Advanced list Functionality and you'll see that it's easy to loop through all Sections and make a list of the images there.

    E.g.
    Code:
    <script type="text/javascript">
    var sImages = new Array('dummy.jpg'<actinic:block type="EntireSectionList"><actinic:block if="%3cactinic%3avariable%20name%3d%22SectionImageFileName%22%20%2f%3e%20%21%3d%20%27%27" >,'<actinic:variable name="SectionImageFileName" encoding="perl" selectable="false" />'</actinic:block></actinic:block>);
    </script>
    Replace dummy.jpg with a real file (it's needed to balance the commas).
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hi Norman!

      I have just this minute managed to solve it using the YahooSections method!!!

      This way I can get each section scrolling through their own product images!

      Thanks for the code above - It will come in handy I'm sure,

      Thanks again,

      Oli

      Comment

      Working...
      X