hi all,


this function working fine but when click on pagination number on webpage previous number is not disable

any help appre..

function show_paging($recordset_name=""){
		
		
		if($recordset_name==""){
			
			exit;
		}else{
			$Prev_Link = "";
			$Next_Link = "";
			$Page_Link = "";
			$Query_String = "";
			$Post_Vars = "";

			$TotalPages = $this->RESULTS[$recordset_name]['total_pages'];
			
			$Current_Page = $this->getCurrentPageName();
      //echo $Current_Page;  
			$Segments = ceil($TotalPages / $this->RESULTS[$recordset_name]['segment_length']);
			 echo $Segments;                                   
			$FromCounter = (($this->RESULTS[$recordset_name]['current_segment']-1)* $this->RESULTS[$recordset_name]['segment_length']);
			echo $FromCounter;
			$FromCounter = $FromCounter<0?0:$FromCounter;
      echo "ss".$FromCounter; 
			$PageRemained = ($TotalPages - $FromCounter);

			if($PageRemained>=$this->RESULTS[$recordset_name]['segment_length']){
				$ToCounter = $FromCounter + $this->RESULTS[$recordset_name]['segment_length'];
			}else{
				$ToCounter = $FromCounter + $PageRemained;
			}

			$ToCounter = $ToCounter<0?0:$ToCounter;
			
			if($ToCounter > $FromCounter){
				$Query_String = $this->getCurrentQuerystring();
				$Query_String = $this->filterQueryString($Query_String);
				$Post_Vars = $Query_String!=""?"&".$this->getPostVars():$this->getPostVars();
			
				$Post_Vars = $Post_Vars=="&"?"":$Post_Vars;
				$Query_String = $Query_String.$Post_Vars;
	       
				$Query_String = $Query_String!=""?"&".$Query_String:"";
	
				if($this->RESULTS[$recordset_name]['current_segment']>=2){
					$Prev_Link = "<a href='".$Current_Page."?pg_no=".($FromCounter-1).$Query_String."' class='".$this->CLASS_LINK."'>&lt;&lt;Prev</a>";
				}else{
					$Prev_Link = "<span class='".$this->CLASS_NOLINK."'>&lt;&lt;Prev</span>";
				}
	
				for($i=$FromCounter; $i<$ToCounter; $i++){
					$Page_Link.="&nbsp;";
					if($i==$this->CURRENT_PAGE){
						$Page_Link.="<span class='".$this->CLASS_SELECTED."'>".($i+1)."</span>";
						$this->CURRENT_QUERY_STRING = "pg_no=".$i."&".$Query_String;
					}else{
						$Page_Link.="<a href='".$Current_Page."?pg_no=".$i.$Query_String."' class='".$this->CLASS_LINK."'>".($i+1)."</a>";
					}
				}
	
				$Next_Link.= "&nbsp;";
	
				if($this->RESULTS[$recordset_name]['current_segment']<$Segments){
					$Next_Link.= "<a href='".$Current_Page."?pg_no=".$ToCounter.$Query_String."' class='".$this->CLASS_LINK."'>Next&gt;&gt;</a>";
				}else{
					$Next_Link.= "<span class='".$this->CLASS_NOLINK."'>Next&gt;&gt;</span>";
				}
	
				echo $Prev_Link.$Page_Link.$Next_Link;
			}
		}
	}

Recommended Answers

All 3 Replies

I'm not sure where you want to disable the previous link. Here is easy way to configure the pagination.
To disable previous link, prepare the current page and 1.
To disable next link, prepare the current page and the total numbers of the page.

Hope this help.

If you want to learning then its good, otherwise there are thousands of ready script.
Better to use them. phpclasses have good classes.

I'm not sure where you want to disable the previous link. Here is easy way to configure the pagination.
To disable previous link, prepare the current page and 1.
To disable next link, prepare the current page and the total numbers of the page.

Hope this help.

hey this line shows previous link not clickable

//this is in else condition
$Prev_Link = "<span class='".$this->CLASS_NOLINK."'>&lt;&lt;Prev</span>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.