0

Hi guys, I have my code and it works of filtering data by Month and year.But it seems i got a problem when using accordion. i am kinda stack of it. Can anyone please help me out? This is my codes.

<link href="../_css/getpinoy.css" rel="stylesheet" type="text/css" />
<script src="../_utility/loadFlash.js" type="text/javascript"></script>
<script src="../_script/jquery-latest.js"></script>
<script src="../_script/jquery.tools.min.js"></script>

<script src="../_script/ddaccordion.js">
/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script type="text/javascript">

//Initialize first demo:
ddaccordion.init({
	headerclass: "update", 
	contentclass: "mid_4_a_maincontent_newsarea", 
	revealtype: "click", //"click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //revealtype="mouseover"
	collapseprev: true, //true/false 
	defaultexpanded: [0], //[index1, index2, etc]. [] denotes no content.
	onemustopen: true, 
	animatedefault: true, //default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openupdate"], // respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "1500", //(ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

</script>
<link href="../_css/getpinoy.css" rel="stylesheet" type="text/css" />
<script src="../_utility/loadFlash.js" type="text/javascript"></script>
<script src="../_script/jquery-latest.js"></script>
<script src="../_script/jquery.tools.min.js"></script>

<script src="../_script/ddaccordion.js">
/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script type="text/javascript">

//Initialize first demo:
ddaccordion.init({
	headerclass: "update", 
	contentclass: "mid_4_a_maincontent_newsarea", 
	revealtype: "click", //"click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //revealtype="mouseover"
	collapseprev: true, //true/false 
	defaultexpanded: [0], //[index1, index2, etc]. [] denotes no content.
	onemustopen: true, 
	animatedefault: true, //default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openupdate"], // respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "1500", //(ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

</script>
<?php

/* Database config */

$db_host		= 'localhost';
$db_user		= 'root';
$db_pass		= 'nobility';
$db_database	= 'testdb'; 

/* End config */


$con = @mysql_connect($db_host,$db_user,$db_pass) or die('Unable to establish a DB connection');

mysql_query("SET NAMES 'utf8'");
mysql_select_db($db_database,$con);
function displayContent($global_dates,$link_url,$global_title,$global_link,$global_img,$global_alt,$global_desc,$global_src,$link_desc){
	
	if(($link_url == "" && $link_url == 0) or ($global_title == "" && $global_link == 0)){
	  
      echo "<div class='hold'><a class='click_me' href='$global_link' target='_blank'>$global_title</a></div>";
      echo "<div class='tool'><img src='$global_img' alt='$global_alt' width='80' height='60' border='0' />";
      echo "<p>$global_desc - <b>$global_src</b></p></div>";
	  //

    }else{
	  $yourDescriptionVar = $link_desc ;
	  $yourLinkVar = $link_url;
      $descriptions = explode("|", $yourDescriptionVar);
	  $links = explode("|", $yourLinkVar);
	  //echo "<div class='mid_4_a_maincontent_newsarea'>";
	  
      echo "<div class='hold'><a rel='local1' class='click_me' href='$global_link' target='_blank'>$global_title</a></div>";
  //		//<!-- tooltip -->
      echo "<div class='tooltip'>";
      echo "<h2>Related Article:</h2>";
	  echo "<h3>" ;
      for( $i = 0; $i< count($descriptions); $i++){  
		echo $i+1 . ".<a href='$links[$i]' title='$global_title' target='_blank'> $descriptions[$i]</a> <br />";
       }
	  echo "</h3>" ;
      echo "</div>" ;
      echo "<div class='tool'><img src='$global_img' alt='$global_alt' width='80' height='60' border='0' />";
      echo "<p>$global_desc - <b>$global_src</b></p></div>"; 
	 // echo "</div>";
        //<!--End tooltip -->
	 //echo "</div>";
    }
	
}
function dateConvert($timestamp){
   return date('F j, Y',strtotime($timestamp));
   }

function hrsConvert($timestamp){
   return date('g:i a',strtotime($timestamp));
  }

?>
<?php
   
    $year = $_REQUEST['year'];
	$month = $_REQUEST['month'];
	$last_date = "";
	$result = mysql_query("SELECT *, YEAR(local_date) as year, monthname(local_date) as month FROM tbl_localnews where year(local_date)='".$year."' AND monthname(local_date) = '".$month."'  ORDER BY local_date DESC "); 
	
	echo "<div class='mid_4_a_maincontent'>";
	while ($row = mysql_fetch_array($result)) {
    //call function displayContent()
	$global_dates = $row['local_date']; 
	$link_url = $row['link_url']; 
	$global_title = $row['local_title']; 
	$global_link = $row['local_link'];
	$global_img = $row['local_img']; 
	$global_alt = $row['img_alt']; 
	$global_desc = $row['local_desc'];
	$global_src = $row['local_src'];
	$link_desc = $row['link_desc'];
	
	if ($global_dates != $last_date) {
	   
       echo "<h3 class=\"update\">";
       echo "<em>News for ".dateConvert($global_dates)."</em>";
       echo "<em style=\"font-size:12px; float:right;\">Updated ".hrsConvert($global_dates)."</em>";
       echo "</h3>";
        $last_date = $global_dates;
	
    }
//this is for displaying data through accordion but seems it does not work	
echo "<div class='mid_4_a_maincontent_newsarea'>";	displayContent($global_dates,$link_url,$global_title,$global_link,$global_img,$global_alt,$global_desc,$global_src,$link_desc);
echo "</div>";
		
	
	}	
   mysql_free_result($result);  
    echo "</div>";                         

?>

Edited by rolyestemonio: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by cossay
0

Can anyone help me with a project title or topic that I can implement with PHP for final year project?

Edited by cossay: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.