Page 1 of 2

Paginate Content Parts !!!

Posted: Sat 5. May 2007, 22:54
by jsw_nz
Just wanted to post this.

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">&laquo; Previous</a>[/CP_PAGINATE_PREV]
[CP_PAGINATE]{CP_PAGINATE}[/CP_PAGINATE]
[CP_PAGINATE_NEXT]	<a href="{CP_PAGINATE_NEXT}" class="cpPaginationNext">Next &raquo;</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]&nbsp;&nbsp;";
				$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"]); 
 } ?>
cheers

Posted: Sat 2. Jun 2007, 14:40
by Oliver Georgi
I really don't understand the need of {Bottom...}

Oliver

Posted: Sat 2. Jun 2007, 15:28
by flip-flop
Mhh, if I have a look over the sholder of a simple user it make sense for me to palce a bottom navigation. Current I have more then one question from users regarding this feature.
I agree with jsw_nz, it is a useful enhancement.

Knut

Posted: Sat 2. Jun 2007, 16:16
by pepe
WHY ALL THAT CODE????

I DON'T understand the NEED of this addition RT??

If you copy (something like) the following codelines into your "bottom-section" of your normal template...
It's just the same ... :idea:

Or do i miss something :?:
<div id="pepesBottomSection">

<!--CP_PAGINATE_START//-->
<div class="cpPagination">
[CP_PAGINATE_PREV] <a href="{CP_PAGINATE_PREV}" class="cpPaginationPrev">&laquo; Previous</a>[/CP_PAGINATE_PREV]
[CP_PAGINATE]{CP_PAGINATE}[/CP_PAGINATE]
[CP_PAGINATE_NEXT] <a href="{CP_PAGINATE_NEXT}" class="cpPaginationNext">Next &raquo;</a>[/CP_PAGINATE_NEXT]
</div>
<!--CP_PAGINATE_END//-->

</div>

Posted: Sat 2. Jun 2007, 17:12
by Oliver Georgi
yepp Pepe, that's exactly how it works :)

Oliver

Posted: Sun 3. Jun 2007, 06:02
by jsw_nz
Hi Pepe,

All ears here - I think the problem I was having was related to pagination being conditional BASED ON how I created my CSS pagelayout templates, thus the need for this approach. There is a special variable that I use in situations with Flash. global $no_print_bottom_paginate;

I pasted your code successfully which works apart from some minor CSS adjustments. So yes, thanks for the pointer of using more standard code.
Don't want to add to any confusion - just my approach.

cheers
:)

anyway the pagination feature in wcms is great - thanks Oli

Posted: Sun 3. Jun 2007, 12:11
by pepe
OK John,

and - if i take a long think - a great advantage over the "normal way", using your new ReplacementTag {BOTTOM_PAGINATE} is much easier to remember "some days later" ...

So: One point extra for NZ :lol:

Posted: Tue 12. Jun 2007, 10:53
by danielreeders
flip-flop wrote:Mhh, if I have a look over the sholder of a simple user it make sense for me to palce a bottom navigation. Knut
I've just setup pagination using the code provided above, and it worked like a charm, but I'd also like to choose where it appears... Most of the news sites I read offer a "single page" link at the top of the article, and a page turn mechanism at the bottom of the article. See the NY Times for an example.

Instead of adding PHP code it's preferable to use the template system Oliver has already provided. You can modify the CSS class for the top pagination <DIV> in the template, then use the visibility attribute on that class in your CSS to hide it.

[EDIT] It turns out you can do this already. Simply edit template/inc_default/article_summary.tmpl and change it to read:

Code: Select all

<div class="cpPaginationTop">
[ANOTHER EDIT] You also need to make the same change in template/inc_default/article_summary_paginate.tmpl so the top pagination disappears on all pages subsequent to the first page.

Then change your frontend.css to read:

Code: Select all

div.cpPagination, div.cpPaginationTop {
	margin: 10px 0 10px 0;
	text-align: right;
}

div.cpPaginationTop {
        display: table-row;
        visibility: collapse;
}
[NOTE] I've used display: table-row; and visibility: hidden; to avoid the unwanted whitespace that may occur in a table-based layout when you set the pagination DIV to visibility: hidden.

Posted: Tue 12. Jun 2007, 11:07
by juergen
Yepp !

Full ack! Just thought abt whats happening to a normal user, reading from top to bottom !

So John(superhero) ;)

Just reminds me fishing replacement tags from code in 1.3.3 *g*

Thanks for info

Jürgen

Re: Paginate Content Parts !!!

Posted: Fri 2. May 2008, 18:52
by dbaron
Hello alls

I used exactly this code below to my template for pagination (I used the last update of phpwcms: phpwcms_r150.7z)
but the result is quite strange: see http://www.nirad.fr/new150/index.php?Fleurs-1 :
the page one is not correct, the page 2 and 3 yes.

Could you help me please, because I don't understand why I have this like that.

Thanks for advance
jsw_nz wrote:Just wanted to post this.

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">&laquo; Previous</a>[/CP_PAGINATE_PREV]
[CP_PAGINATE]{CP_PAGINATE}[/CP_PAGINATE]
[CP_PAGINATE_NEXT]	<a href="{CP_PAGINATE_NEXT}" class="cpPaginationNext">Next &raquo;</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
:) :)


cheers

Re: Paginate Content Parts !!!

Posted: Fri 2. May 2008, 19:03
by update
is there any instance of an <ul><li> based navi in this template perhaps? Then uncomment it for testing....

Re: Paginate Content Parts !!!

Posted: Fri 2. May 2008, 19:04
by flip-flop
Hi,

- article_summary.tmpl for the first side,
- article_summary_paginate.tmpl für all other sides.

Have a look: It is a new feature {CP_PAGINATE_MENU}

Knut

Re: Paginate Content Parts !!!

Posted: Fri 2. May 2008, 19:34
by dbaron
thanks a lot, I modified article_summary_paginate.tmpl but not article_summary.tmpl, that's why I had this problem.

thanks again.
flip-flop wrote:Hi,

- article_summary.tmpl for the first side,
- article_summary_paginate.tmpl für all other sides.

Have a look: It is a new feature {CP_PAGINATE_MENU}

Knut

Re: Paginate Content Parts !!!

Posted: Fri 2. May 2008, 19:35
by Jensensen
[x]

Re: Paginate Content Parts !!!

Posted: Fri 2. May 2008, 20:13
by dbaron
It is one article with 3 CP, one per page.