Re: mod rewrite - DMXzone's PHP Pagination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 17 November 2010,

Richard West <php@xxxxxxxxxx> wrote:

> Hello Guys, Gals,

Hello Richard,

Probably you need to add your rule as follows:

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteRule ^/blog-(.*).html$ /blog.html?pageNum_rsBlog=$1 [QSA,L]

</IfModule>

> I've been working on a project of mine creating a custom little cms. I've

> managed to go by tutorials and reference material from the php site to

> get as far as I have. I've got search engine friendly links working with

> mod rewrite using mysql entry of page alias and my code is like /<?php

> echo $_row['alias']; ?>.html

>

> Now that was simple to what I have ran into...

>

> DMXzone has a dreamweaver extension called PHP Pagination which creates

> very nice paging links. But it has a huge class and its function to

> print links is over my head. I'm new to the list and I know how

> aggravating it can be to volunteer help and I give everyone many thanks

> that makes the effort to help others. I'm sure you all are blessed in

> many ways.

>

> Can a new guy to the list just jump right in and ask for help? - lol

>

> If someone here a guru at mod_rewrite, please help me get through this

> step because i'm stuck...

>

> My url to my integrated blog is

> /blog.html

>

> after click pagination

> /blog.html?pageNum_rsBlog=1

>

> my htaccess I have added

> <IfModule mod_rewrite.c>

> RewriteEngine on

> RewriteRule blog-(.*).html$ /blog.html?pageNum_rsBlog=$1

> </IfModule>

>

> my link should end up

> /blog-1.html

>

> I hope its ok to post this long function

> here is the dmxzone function inside pagination class

>

> function addPagination()

> {

> $pageNo = 1;

> $recPerPage = 1;

> if ($this->recordsetName != "") {

> $dsName = $this->recordsetName;

> $offsetName = "pageNum_";

> $useOffset = 0;

> } else {

> $dsName = $this->feedGenieName;

> $offsetName = "offset_";

> $useOffset = 1;

> $recPerPage = $this->rowsPerPage;

> }

>

> $this->numPages = ceil($this->rowsTotal / $this->rowsPerPage);

> if ($this->numPages < 2)

> {

> return;

> }

>

> $curPageUrl = substr("/blog.html", strrpos("/blog.html", "/")

> +1); // $curPageUrl = substr($_SERVER['PHP_SELF'],

> strrpos($_SERVER['PHP_SELF'], "/") +1);

>

> if (isset($_GET[$offsetName.$dsName]))

> {

> if ($useOffset == 0) {

> $pageNo = intval($_GET[$offsetName.$dsName]) + 1;

> } else {

> $pageNo = (intval($_GET[$offsetName.$dsName]) /

> $this->rowsPerPage) + 1; }

> }

> $pageNumParam = $offsetName.$dsName."=";

> $curPageUrl .= "?";

>

> $queryString = "";

> if (!empty($_SERVER['QUERY_STRING']))

> {

> $params = explode("&", $_SERVER['QUERY_STRING']);

> $newParams = array();

> foreach ($params as $param)

> {

> if (stristr($param, $offsetName.$dsName) == false &&

> stristr($param, "totalRows_".$dsName) == false) {

> array_push($newParams, $param);

> }

> }

> if (count($newParams) != 0)

> {

> $queryString = "&" . htmlentities(implode("&",

> $newParams)); }

> }

> echo "<div class=\"dmxpagination\">";

> if ($this->showFirstLast)

> {

> if ($pageNo == 1)

> {

> echo "<span

> class=\"disabled\">".$this->firstLabel."</span>"; }

> else

> {

> $prev = $pageNo - 1;

> echo "<a

> href="">

> class=\"previous\">".$this->firstLabel."</a>"; }

> }

> if ($this->showNextPrev)

> {

> if ($pageNo == 1)

> {

> echo "<span

> class=\"disabled\">".$this->prevLabel."</span>"; }

> else

> {

> $prev = $pageNo - 1;

> echo "<a

> href="">

> " class=\"previous\">".$this->prevLabel."</a>";

>

> }

> }

> if($this->numPages < (($this->outerLinks +

> $this->adjacentLinks)*2 + 1)) {

> for ($i = 1; $i < $this->numPages + 1; $i++)

> {

> if ($pageNo == $i)

> {

> echo "<span class=\"current\">".$i."</span>";

> }

> else

> {

> echo "<a href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> }

> }

> else

> {

> if($pageNo < $this->outerLinks + $this->adjacentLinks + 2)

> {

> for ($i = 1; $i < ($this->outerLinks +

> $this->adjacentLinks*2 + 2); $i++) {

> if ($pageNo == $i)

> {

> echo "<span class=\"current\">".$i."</span>";

> }

> else

> {

> echo "<a href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> }

> if ($this->outerLinks > 0)

> {

> echo $this->pageNumSeparator;

> }

> for ($i = $this->numPages - $this->outerLinks + 1; $i <

> $this->numPages + 1; $i++) {

> echo "<a href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> }

> else

> {

> if ($pageNo < $this->numPages - $this->outerLinks -

> $this->adjacentLinks) {

> for ($i = 1; $i < $this->outerLinks + 1; $i++)

> {

> echo "<a

> href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> if ($this->outerLinks > 0)

> {

> echo $this->pageNumSeparator;

> }

> for ($i = $pageNo - $this->adjacentLinks; $i <

> $pageNo + $this->adjacentLinks + 1; $i++) {

> if ($pageNo == $i)

> {

> echo "<span class=\"current\">".$i."</span>";

> }

> else

> {

> echo "<a

> href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> }

> if ($this->outerLinks > 0)

> {

> echo $this->pageNumSeparator;

> }

> for ($i = $this->numPages - $this->outerLinks + 1; $i

> < $this->numPages + 1; $i++) {

> echo "<a href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> }

> else

> {

> for ($i = 1; $i < $this->outerLinks + 1; $i++)

> {

> echo "<a href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> if ($this->outerLinks > 0)

> {

> echo $this->pageNumSeparator;

> }

> for($i = $this->numPages - ($this->outerLinks +

> ($this->adjacentLinks*2)); $i < $this->numPages + 1; $i++) {

> if ($pageNo == $i)

> {

> echo "<span class=\"current\">".$i."</span>";

> }

> else

> {

> echo "<a

> href="" -

> 1)*$recPerPage.$queryString."\">".$i."</a>"; }

> }

> }

> }

> }

> if ($this->showNextPrev)

> {

> if ($pageNo == $this->numPages)

> {

> echo "<span

> class=\"disabled\">".$this->nextLabel."</span>"; }

> else

> {

> $next = $pageNo + 1;

> echo "<a href="" -

> 1)*$recPerPage.$queryString."\"

> class=\"next\">".$this->nextLabel."</a>"; }

> }

> if ($this->showFirstLast)

> {

> if ($pageNo == $this->numPages)

> {

> echo "<span

> class=\"disabled\">".$this->lastLabel."</span>"; }

> else

> {

> $next = $pageNo + 1;

> echo "<a

> href="" -

> 1)*$recPerPage.$queryString."\"

> class=\"next\">".$this->lastLabel."</a>"; }

> }

> echo "</div>";

> }

>

>

>

>

> I have no idea how to fix this function

> all advice appreciated

> thanks

> RD

Best regards,

--

Daniel Molina Wegener <dmw [at] coder [dot] cl>

System Programmer & Web Developer

Phone: +56 (2) 979-0277 | Blog: http://coder.cl/

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux