Page 1 of 1

CreatePagination new?

Posted: Fri Sep 30, 2005 5:41 pm
by kishman155
In a module i write it would be nice if there is the ability to keep sorting functions i made with links in CreatePagination and gave it
to the next site.
It wasn't available so i modified paganition.

Code: Select all

function CreatePagination1($id, $action, $returnid,$page , $items, $totalrows, $limit, $inline=false)
	{
		$goto = 'moduleinterface.php';
		if ($inline)
		{
			$goto = 'index.php';
		}
		$text='';
		if(isset($items))
		{
		
		foreach($items as $keys=>$values)
		{
			$text .= '&'.$id.$values.'='.$keys;
		}
		}
		$link = '<a href="'.$goto.'?module='.$this->GetName().'&'.$id.'returnid='.$id.$returnid.'&'.$id.'page=';
		if ($inline)
		{
			$link .= '&'.$this->cms->config['query_var'].'='.$returnid;
		}
		$page_string = "";
		$from = ($page * $limit) - $limit;
		$numofpages = floor($totalrows / $limit);
		if ($numofpages * $limit < $totalrows)
		{
			$numofpages++;
		}

		if ($numofpages > 1)
		{
			if($page != 1)
			{
				$pageprev = $page-1;
				$page_string .= $link.$pageprev;
				if(isset($text))
				{
					$page_string .=$text;
				}
				$page_string .="\">".lang('previous')."</a> ";
			}
			else
			{
				$page_string .= lang('previous')." ";
			}

			for($i = 1; $i <= $numofpages; $i++)
			{
				if($i == $page)
				{
					 $page_string .= $i." ";
				}
				else
				{
					 $page_string .= $link.$i;
				if(isset($text))
				{
					$page_string .=$text;
				}
				$page_string .="\">$i</a> ";
				}
			}

			if (($totalrows - ($limit * $page)) > 0)
			{
				$pagenext = $page+1;
				$page_string .= $link.$pagenext;
				if(isset($text))
				{
					$page_string .=$text;
				}
				$page_string .="\">".lang('next')."</a>";
			}
			else
			{
				$page_string .= lang('next')." ";
			}
		}

		return $page_string;
	}


I hope it will be helpful

kishman155

Re: CreatePagination new?

Posted: Fri Oct 28, 2005 5:17 pm
by Svenni
Have you a running version of it? I get lots of errors if I upload it to the plugin-dir as function.CreatePaganition in the module-adminstration. :(

Re: CreatePagination new?

Posted: Fri Oct 28, 2005 6:17 pm
by kishman155
It is insite the class.module it wasn't done for  make it as an plugin or like this.

mfg
kishman155