Paginate Content Parts !!!
Posted: Sat 5. May 2007, 22:54
Just wanted to post this.
Just looked over paginate contentparts addition to 133.
Was able to paste this code into existing full article templates
Works like a gem.
Only thing to remember is to designate subsection number
the rest gets sorted.....!
Another superior solution from OliG - big THANKS
cheers
john

UPDATE:
I used the existing script which works great inside article full summary templates, but was needing a way to add an identical pagination nav bar at bottom of page. Since the use of pagination is conditional, created a temporary solution {REP_TAG} that places an identical bar at bottom of page - when article_paginate is true -- placed the rep tag inside page template and placed the php file (below) inside inc_script/frontend_render :
{BOTTOM_PAGINATE}
cheers
Just looked over paginate contentparts addition to 133.
Was able to paste this code into existing full article templates
Code: Select all
<!--CP_PAGINATE_START//-->
<div class="cpPagination">
[CP_PAGINATE_PREV] <a href="{CP_PAGINATE_PREV}" class="cpPaginationPrev">« Previous</a>[/CP_PAGINATE_PREV]
[CP_PAGINATE]{CP_PAGINATE}[/CP_PAGINATE]
[CP_PAGINATE_NEXT] <a href="{CP_PAGINATE_NEXT}" class="cpPaginationNext">Next »</a>[/CP_PAGINATE_NEXT]
</div>
<!--CP_PAGINATE_END//-->
Works like a gem.
Only thing to remember is to designate subsection number
the rest gets sorted.....!
Another superior solution from OliG - big THANKS
cheers
john


UPDATE:
I used the existing script which works great inside article full summary templates, but was needing a way to add an identical pagination nav bar at bottom of page. Since the use of pagination is conditional, created a temporary solution {REP_TAG} that places an identical bar at bottom of page - when article_paginate is true -- placed the rep tag inside page template and placed the php file (below) inside inc_script/frontend_render :
{BOTTOM_PAGINATE}
Code: Select all
<?php
function get_article_pagination($dbcon) {
$article_id = $article_id ? $article_id : $GLOBALS["content"]["article_id"];
$article_id = intval($article_id);
$sql = "SELECT article_paginate, article_id ";
$sql .= "FROM ".DB_PREPEND."phpwcms_article WHERE article_id = ".$article_id;
if($result = mysql_query($sql, $dbcon)) {
while ($row = mysql_fetch_array($result)) {
$bottom_paginate = $row['article_paginate'];
if($bottom_paginate){
$bottom_pagination_code = "<div class=\"cpPagination_bottom\">";
$bottom_pagination_code .= "[CP_PAGINATE]{CP_PAGINATE}[/CP_PAGINATE] ";
$bottom_pagination_code .= "[CP_PAGINATE_PREV] <a href=\"{CP_PAGINATE_PREV}\" class=\"cpPaginationPrev\">";
$bottom_pagination_code .= "<img src=\"img/site/btn_previous.gif\" border=\"0px\"/></a>";
$bottom_pagination_code .= "[/CP_PAGINATE_PREV]";
$bottom_pagination_code .= "[CP_PAGINATE_NEXT] <a href=\"{CP_PAGINATE_NEXT}\" class=\"cpPaginationNext\">";
$bottom_pagination_code .= "<img src=\"img/site/btn_next.gif\" border=\"0px\"/></a>[/CP_PAGINATE_NEXT]";
$bottom_pagination_code .= "</div>";
}
} // end while
} // end if
mysql_free_result($result);
return $bottom_pagination_code;
}
// BOTTOM_PAGINATE replacement
if( ! (strpos($content["all"],'{BOTTOM_PAGINATE}')===false)) {
$content["all"] = preg_replace('/\{BOTTOM_PAGINATE\}/e','get_article_pagination($db);',$content["all"]);
} ?>