You are here: Re: Splitting an article into multiple pages. « PHP Programming Language « IT news, forums, messages
Re: Splitting an article into multiple pages.

Posted by Carl on 11/15/37 11:22

guitarromantic@gmail.com wrote:
> Hey everyone.
>
> Following advice found online, I figured out a basic way of splitting a
> long article into several pages, by exploding out from a
> <!--pagebreak--> code in my $content field.
>
> http://www.scenepointblank.com/matt/dev/features/index.php?id=1&page=1
>
> Sample above. The next/previous links were built with simple values:
>
> $pagenext = ($_GET['page']) + 1;
> $pageprev = ($_GET['page']) - 1;
>
> This is pretty basic level stuff (and knowing my luck, probably
> horribly insecure too..), so what I really need is for the system to
> know how many "pages" there are (or how many sections split by
> <!--pagebreak--> tags), and then I can work with this value, and print
> a list like "Page 1 | Page 2 | Page 3" rather than just basic
> previous/next links. How can I do this?
>

I'm not 100% sure I understand your question; are you separating your
'pages' by entering the text "<!--pagebreak-->" in your content, and
then using the explode() method to break up the pages?

If that is correct, then given:

$allPages = explode('<!--pagebreak-->', $content);
$pageCount = count($allPages); // total # of pages found
$currentContent = $allPages[$_GET['page']]; // current page content

Hope that helps,
Carl.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация