XHTML Transitional Compliant Paging with ADOdb
January 4th, 2008Following on from my previous post, I’ve cleaned up the getNavigation() function to generate XHTML Transitional compliant code. It’s good for all kinds of things, if nothing else, you’ll live longer.
Just replace the following function in your class.GenericEasyPagination.php
function getNavigation() { $result = ""; $previous = $this->currentPage - 1; $next = $this->currentPage + 1; if ($this->getsVars ==""): if ($this->PagesFound>1): if ($this->currentPage!=1): $result .= "<a href='?page=1' title='".$this->msg_initialPage."'><img border=\"0\" src=\"/_common_images/icons/resultset_first.png\" alt=\"resultset_first\" /></a> "; endif; if ($this->currentPage>1): $result .= "<a href='?page=".($previous)."'>< border=\"0\" src=\"/_common_images/icons/resultset_previous.png\"></a> "; endif; if (($this->currentPage < $this->PagesFound) && ($this->PagesFound >= 1)): $result .= " <a href='?page=".($next)."'><img border=\"0\" src=\"/_common_images/icons/resultset_next.png\" alt=\"resultset_next\" /></a>"; endif; if (($this->PagesFound>1)&&($this->currentPage!=$this->PagesFound)): $result .= " <a href='?page=".$this->PagesFound."'><img border=\"0\" src=\"/_common_images/icons/resultset_last.png\" alt=\"resultset_last\" /></a>"; endif; endif; else: if ($this->currentPage!=1): $result = "<a href='?page=1&".$this->getsVars."' title='".$this->msg_initialPage."'><img border=\"0\" src=\"/_common_images/icons/resultset_first.png\" alt=\"resultset_first\" /></a> "; endif; if ($this->currentPage>1): $result .= "<a href='?page=".($previous)."&".$this->getsVars."'><img border=\"0\" src=\"/_common_images/icons/resultset_previous.png\" alt=\"resultset_previous\" / ></a> "; endif; if (($this->currentPage<$this->PagesFound) && ($this->PagesFound>=1)): $result .= "<a href='?page=".($next)."&".$this->getsVars."'><img border=\"0\" src=\"/_common_images/icons/resultset_next.png\" alt=\"resultset_next\" /></a>"; endif; if (($this->PagesFound>1)&&($this->currentPage!=$this->PagesFound)): $result .= " <a href='?page=".$this->PagesFound."&".$this->getsVars."' title='".$this->msg_finalPage."'> >></a>"; endif; endif; return $result; }
| Bookmark it del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Propeller | Yahoo |
Was this post useful to you? Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the PHP category.