Results 1 to 2 of 2

Thread: Drop down/ Overlapping Content script not working in PHP loop

  1. #1
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Drop down/ Overlapping Content script not working in PHP loop

    1) Script Title: Drop down/ Overlapping Content script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...lapcontent.htm

    3) Describe problem:


    I want to use this in a PHP page that shows a series of database results. The results display fine but the problem I am running into is that when I insert the script into the loop (either within the if statement or outside of it, the <rev=> aspect of the link only works for the first result. The rest of the results try to goto the <href> segment of the script.

    Each of the <rev> elements need to open the window with the ASSIGNMENT for that record.

    How do I alter this to do this?

    Here is a sample of the PHP code with the script <a href> call I am referring to:

    Code:
    <?php do { ?>
    
    <?php echo($row_WADATEST['NAME']); ?>
    
    <?php
    	if ($row_WADATEST['STATUS'] == 1)
    		{
    ?>
    
    	<a href="search.htm" id="searchlink" rel="subcontent" rev="/calendar/demo1.php?showCat=<?php echo(substr($row_WADATEST['ASSIGNMENT'], 0, strpos($row_WADATEST['ASSIGNMENT'], "*")+4)); ?>">Calendar</a></b><br />
    				<!--Drop Down content element -->
    				<DIV id="subcontent" style="position:absolute; visibility: hidden; border: 9px solid orange; background-color: white; width: 300px; padding: 8px;">
    
    				//EMPTY DIV!!
    
    				</DIV>		
    <?php
    }
    else
    {
       echo "&nbsp;";
    }
    ?>

  2. #2
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I got it!

    I had to take the <div> and the <script> instance and place them inside the loop as well. Once I did that I pulled a unique id, in this case ID and performed a php echo to create a unique instance of the div id and anchor id. Hopefully this will help someone else:

    <?php do { ?>

    <?php echo($row_WADATEST['NAME']); ?>

    <?php
    if ($row_WADATEST['STATUS'] == 1)
    {
    ?>

    <a href="search.htm" id="searchlink" rel="subcontent" rev="/calendar/demo1.php?showCat=<?php echo(substr($row_WADATEST['ASSIGNMENT'], 0, strpos($row_WADATEST['ASSIGNMENT'], "*")+4)); ?>">Calendar</a></b><br />
    <!--Drop Down content element -->
    <DIV id="subcontent<?php echo(rawurlencode($row_WADATEST['ID'])); ?>" style="position:absolute; visibility: hidden; border: 9px solid orange; background-color: white; width: 300px; padding: 8px;">

    //EMPTY DIV!!

    </DIV>
    <script type="text/javascript">
    //Call dropdowncontent.init("anchorID", "positionString", glideduration, "revealBehavior") at the end of the page:
    dropdowncontent.init("searchlink<?php echo(rawurlencode($row_WADATEST['ID'])); ?>", "left-top", 550, "click")
    </script>
    <?php
    }
    else
    {
    echo "&nbsp;";
    }
    ?>

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
  •