Paginate Content Parts !!!

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Paginate Content Parts !!!

Post 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
User avatar
Oliver Georgi
Site Admin
Posts: 9913
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

I really don't understand the need of {Bottom...}

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post 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
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post 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>
User avatar
Oliver Georgi
Site Admin
Posts: 9913
Joined: Fri 3. Oct 2003, 22:22
Contact:

Post by Oliver Georgi »

yepp Pepe, that's exactly how it works :)

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
User avatar
jsw_nz
Posts: 907
Joined: Fri 2. Apr 2004, 02:42
Location: New Zealand

Post 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
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post 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:
danielreeders
Posts: 14
Joined: Wed 30. May 2007, 09:25

Post 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.
Last edited by danielreeders on Tue 12. Jun 2007, 11:18, edited 2 times in total.
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Post 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
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Re: Paginate Content Parts !!!

Post 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
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: Paginate Content Parts !!!

Post by update »

is there any instance of an <ul><li> based navi in this template perhaps? Then uncomment it for testing....
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Paginate Content Parts !!!

Post 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
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Re: Paginate Content Parts !!!

Post 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
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: Paginate Content Parts !!!

Post by Jensensen »

[x]
Last edited by Jensensen on Sat 20. Sep 2008, 03:34, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Re: Paginate Content Parts !!!

Post by dbaron »

It is one article with 3 CP, one per page.
Post Reply