CreatePagination new?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

CreatePagination new?

Post 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
Svenni

Re: CreatePagination new?

Post 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. :(
kishman155
Translator
Translator
Posts: 169
Joined: Sat Mar 12, 2005 12:30 pm
Location: Vienna

Re: CreatePagination new?

Post by kishman155 »

It is insite the class.module it wasn't done for  make it as an plugin or like this.

mfg
kishman155
Post Reply

Return to “Developers Discussion”