
<?php /* * Name: Pip (Pagination Plugin) * Version: 1.0 * Author: Armand "bS" Pondman ([email protected]) * Updated: June 7, 2006 12:00 CET * * Description: * will paginate a document when delimiter is found in the content. */ ## CUSTOMIZE ## $delimiter = '<!--pb-->'; $tplLinkNext = '<a href="[+link+]" title="Next page">»</a>'; $tplLinkPrev = '<a href="[+link+]" title="Previous page">«</a>'; $pages = ''; $tplLinkNav = 'Page [+linkprev+] [+pages+] [+linknext+]'; $tplInform = '-- Page [+current+] of [+total+]'; $pipPages = ''; $pip_content = $modx->documentObject['content']; $pip_pagecontent = explode($delimiter,$pip_content); $pip_pagecount = count($pip_pagecontent); if ($pip_pagecount > 1) { $pip_currentpage = isset($_GET["page"]) ? floor(abs($_GET["page"])) : 1; if ($pip_currentpage > $pip_pagecount || $pip_currentpage < 1) { $pip_currentpage = 1; } $char = ($modx->config['friendly_urls'] == 0) ? "&" : "?"; $url = $modx->makeurl($modx->documentIdentifier,'',$char.'page='); $prevpage = $pip_currentpage-1; $nextpage = $pip_currentpage+1; $linkprev = ($prevpage>1 && $prevpage!=1) ? str_replace("[+link+]",$url.$prevpage,$tplLinkPrev) : ''; if ($prevpage==1) {$linkprev = str_replace("[+link+]",$modx->makeurl($modx->documentIdentifier),$tplLinkPrev);} $linknext = ($nextpage>$pip_pagecount) ? '' : str_replace("[+link+]",$url.$nextpage,$tplLinkNext); for ($x=1; $x<=$pip_pagecount; $x++) { if ($x != $pip_currentpage) { if ($x == 1) $pages .= '<a href="'.$modx->makeurl($modx->documentIdentifier).'" title="Page '.$x.' of '. $modx->documentObject['pagetitle'].'">'.$x.'</a> '; else $pages .= '<a href="'.$modx->makeurl($modx->documentIdentifier,'',$char.'page='.$x).'" title="Page '.$x.' of '. $modx->documentObject['pagetitle'].'">'.$x.'</a> '; } else { $pages .= '<span class="active">'.$x.'</span> '; } } $tplLinkNav = str_replace("[+linkprev+]",$linkprev,$tplLinkNav); $tplLinkNav = str_replace("[+linknext+]",$linknext,$tplLinkNav); $tplLinkNav = str_replace("[+pages+]",$pages,$tplLinkNav); $tplInform = str_replace("[+current+]",$pip_currentpage,$tplInform); $tplInform = str_replace("[+total+]",$pip_pagecount,$tplInform); $pip_content= $pip_pagecontent[$pip_currentpage-1]; $modx->setPlaceholder('pipPages', $tplLinkNav); if ($pip_currentpage != 1) // don't show info on first page $modx->setPlaceholder('pipInform', $tplInform); } return $pip_content; ?>
$char = ($modx->config['friendly_urls'] == 0) ? "&" : "?";
$url = $modx->makeurl($modx->documentIdentifier,'',$char.'page=');
$url = $modx->makeurl($modx->documentIdentifier, '', '-');
$pages .= '<a href="'.$modx->makeurl($modx->documentIdentifier,'',$char.'page='.$x).'" title="Page '.$x.' of '. $modx->documentObject['pagetitle'].'">'.$x.'</a> ';
$pages .= '<a href="'.$modx->makeurl($modx->documentIdentifier,'','-'.$x).'" title="Page '.$x.' of '. $modx->documentObject['pagetitle'].'">'.$x.'</a> ';
$url = $modx->makeurl($modx->documentIdentifier').'-';
$pages .= '<a href="'.$modx->makeurl($modx->documentIdentifier).'-'.$x.'" title="Page '.$x.' of '. $modx->documentObject['pagetitle'].'">'.$x.'</a> ';
...
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$ http://apv2/$1 [R=301,L]
# the above directive does not render css and images if http://apv2/ is removed... otherwise works as expected
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)-([0-9]+)$ index.php?q=$1&pg=$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]