douwan2664
2015-04-12 19:20
浏览 41
已采纳

Laravel 5 Pagination CSS Breaking

I'm using Laravel 5 and Bootstrap 3.3.4

So I have the following code in my controller:

$articles = Newsarticles::paginate(10);
return view ('news',compact('articles');

Then in my view I have:

@foreach($articles as $article)

<article>
    <h2>
        <a href="{!! action('DynamicPages@show', [$article->slug]) !!}">{!! $article->headline !!}</a>
    </h2>
    <div class="body">
        {!! substr($article->article,0,500) !!}
    </div>
</article>

@endforeach

{!! $articles->render() !!}

When I run this, the pagination links at the bottom of the page come out just fine and look as they should do. However, if I change the controller to :

$articles = Newsarticles::orderBy('artdate','DESC')->paginate(10);

my pagination links come out like this:

«
1
2
3
4
5
6
»

How can one small adjustment in the code break the css?

图片转代码服务由CSDN问答提供 功能建议

我正在使用Laravel 5和Bootstrap 3.3.4

所以我 在我的控制器中有以下代码:

  $ articles = Newsarticles :: paginate(10); 
return view('news',compact('articles'); 
    
 
 

然后在我看来,我有:

  @foreach($ articles as $ article)
 
&lt;  article&gt; 
&lt; h2&gt; 
&lt; a href =“{!! action('DynamicPages @ show',[$ article-&gt; slug])!!}”&gt; {!! $ article-&gt; 标题!!}&lt; / a&gt; 
&lt; / h2&gt; 
&lt; div class =“body”&gt; 
 {!! substr($ article-&gt; article,0,500)!!} 
&lt  ; / div&gt; 
&lt; / article&gt; 
 
 @ endforeach 
 
 {!! $ articles-&gt; render()!!} 
   
 
 

当我运行它时,页面底部的分页链接就好了,看起来应该如此。但是,如果我将控制器更改为:

  $  articles = Newsarticles :: orderBy('artdate','DESC') - &gt; paginate(10); 
   
 
 

我的分页链接就像 这样的:

«结果,\ N1结果\ N2结果\ N3结果\ N4结果\ N5结果\ N6结果 »

代码中的一个小调整如何打破css?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

相关推荐 更多相似问题