Home  >  Article  >  Backend Development  >  How to paginate typecho archive pages

How to paginate typecho archive pages

WBOY
WBOYOriginal
2016-10-10 11:55:592069browse

Typecho’s archive page article output is what I wrote:

<code class="php"><?php
                    $this->widget('Widget_Contents_Post_Recent', 'pageSize=1000')->to($archives);
                    $year=0; $i=0; $j=0;
                    while($archives->next()):
                        $year_tmp = date('Y',$archives->created);
                        $y=$year;
                        if ($year != $year_tmp && $year > 0) $output .= '<div></div>';
                        if ($year != $year_tmp) {
                            $year = $year_tmp;
                            $output = '<h2 class="archive-year">'. $year .'</h2>';
                        }
                        $output .= '<a class="transition archive-iterm" href="'.$archives->permalink .'"><h3 class="archive-title">'. $archives->title .'</h3><p class="archive-date">'.date('F jS ',$archives->created).'</p></a>';
                    endwhile;
                    
                    echo $output;
                ?></code>

But paging cannot be done. How can I do paging?

Reply content:

Typecho’s archive page article output is what I wrote:

<code class="php"><?php
                    $this->widget('Widget_Contents_Post_Recent', 'pageSize=1000')->to($archives);
                    $year=0; $i=0; $j=0;
                    while($archives->next()):
                        $year_tmp = date('Y',$archives->created);
                        $y=$year;
                        if ($year != $year_tmp && $year > 0) $output .= '<div></div>';
                        if ($year != $year_tmp) {
                            $year = $year_tmp;
                            $output = '<h2 class="archive-year">'. $year .'</h2>';
                        }
                        $output .= '<a class="transition archive-iterm" href="'.$archives->permalink .'"><h3 class="archive-title">'. $archives->title .'</h3><p class="archive-date">'.date('F jS ',$archives->created).'</p></a>';
                    endwhile;
                    
                    echo $output;
                ?></code>

But paging cannot be done. How can I do paging?

What kind of pagination?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn