微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 Vedmant Laravel 提要阅读器进行 RSS 提要分页不起作用

如何解决使用 Vedmant Laravel 提要阅读器进行 RSS 提要分页不起作用

我是 Laravel 的新手,我想用分页显示 RSS 提要。我正在使用 vedmant/laravel-feed-reader Parckage 显示提要,但分页不起作用。我在堆栈流中阅读了以前的问题,例如 displaying-rss-feed-with-php-pagination 和其他材料,但我仍然没有得到解决方案。提要显示但问题是显示所有项目而不是显示每个配置的分页,我的代码有什么问题?。 这是刀片文件中的部分代码

<?PHP

$f = FeedReader::read('http://RSS.example.com/RSS? 
l=Canada&lid=55&affid=k432zxc5f67f3468jfdde03223fe8kdj76190&pzs=50&snl=200');
$items = $f->get_items();
// Make sure the page is being served with the right headers.
$f->handle_content_type();

// Set our paging values
 $start = (isset($_GET['start']) && !empty($_GET['start'])) ? $_GET['start'] : 0; // Where do we 
 start?
 $length = (isset($_GET['length']) && !empty($_GET['length'])) ? $_GET['length'] : 5; // How many per 
 page?
 $max = $f->get_item_quantity(); // Where do we end?

for($i = 0; $i < count($items); $i++){?>
<a class ="RSStitle-link" href="<?=$items[$i]->get_link() ?>" > <?=$items[$i]->get_title()?> </a>

<div class="RSS-content"> <?=$items[$i]->get_content(); ?> 
<a href="<?=$items[$i]->get_link() ?>" > <?=$items[$i]->get_title()?>
                            {{ t('View more') }} <i class="icon-th-list"></i>

                        </a></div>              
                        
<?PHP }
?>
<?PHP
// Let's do our paging controls
$next = (int) $start + (int) $length;
$prev = (int) $start - (int) $length;

// Create the NEXT link
$nextlink = '<a href="?start=' . $next . '&length=' . $length . '">Next &raquo;</a>';
if ($next > $max)
{
    $nextlink = 'Next &raquo;';
}

// Create the PREVIoUS link
$prevlink = '<a href="?start=' . $prev . '&length=' . $length . '">&laquo; PrevIoUs</a>';
if ($prev < 0 && (int) $start > 0)
{
    $prevlink = '<a href="?start=0&length=' . $length . '">&laquo; PrevIoUs</a>';
}
else if ($prev < 0)
{
    $prevlink = '&laquo; PrevIoUs';
}

// normalize the numbering for humans
$begin = (int) $start + 1;
$end = ($next > $max) ? $max : $next;
?>
<p>Showing <?PHP echo $begin; ?>&ndash;<?PHP echo $end; ?> out of <?PHP echo $max; ?> | <?PHP echo 
$prevlink; ?> | <?PHP echo $nextlink; ?> | <a href="<?PHP echo '?start=' . $start . '&length=5'; ? 
>">5</a>,<a href="<?PHP echo '?start=' . $start . '&length=10'; ?>">10</a>,or <a href="<?PHP echo 
'?start=' . $start . '&length=20'; ?>">20</a> at a time.</p>
</div>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。