Kirits

192 经验值

我重新将views/articles/index.blade.phptags/show.blade.php里面,反而可以了,好无语 ==,这问题不知道怎么就解决了

啊啊啊,发现上面好多复制错了,可惜不能改,重新发一份,上面的方便的话删了都可以。
articles.blade.php是页面展示的布局,在views/文件夹根目录下
articles.blade.php:

<!DOCTYPE html>
<html class="no-js" lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Articles</title>
    <link rel='stylesheet' href="/css/all.css" type='text/css' media='all'/>
    <script type='text/javascript' src="/js/all.js"></script>
    <link rel='stylesheet' href="/css/bootstrap.min.css" type='text/css' media='all'/>
    <link rel='stylesheet' href="/css/select2.css" type='text/css' media='all'/>
    <script src="/js/jquery-2.1.4.min.js"></script>
    <script src="/js/select2.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
</head>
<body>
<div id="wrapper">
        <div class="container">
            <section class="content">
                <div class="pad group">
                    @yield('content')
                </div>
            </section>
        </div>

    <nav class="nav-container group" id="nav-footer">
        <div class="nav-wrap">
            <ul class="nav container group">
                <li class="menu-item">
                    <a href="/" rel="nofollow" target="_blank">Laravel 5 Blog</a>
                </li>
            </ul>
        </div>
    </nav>
</div>
</body>
</html>

因为views/articles/index.blade.php的代码是跟tags/show.blade.php的代码一样的
views/articles/index.blade.php的代码:

@extends('articles')
@section('content')
      @foreach($articles as $article)
<article class="format-image group">
    <h2 class="post-title pad">
    <a href="/articles/{ $article->id }"> { $article->title }</a>
    </h2>
    <ul class="post-meta pad group">
        <li><i class="fa fa-clock-o"></i>{ $article->published_at->diffForHumans() }</li>
        @if($article->tags)
            @foreach($article->tags as $tag)
                <li><i class="fa fa-tag"></i><a href="/articles/tags/{ $tag->name }">{ $tag->name }</a></li>
            @endforeach
        @endif
        <li><i class="fa fa-eye"></i>{ count($article->visitors) } 浏览</li>
        <li><i class="fa fa-comments"></i><a target="_blank" href="##">{ count($article->comments) } 评论</a></li>
    </ul>
    <div class="post-inner">
        <div class="post-deco">
            <div class="hex hex-small">
                <div class="hex-inner"><i class="fa"></i></div>
                <div class="corner-1"></div>
                <div class="corner-2"></div>
            </div>
        </div>
        <div class="post-content pad">
            <div class="entry custome">
                { $article->intro }
            </div>
            <a class="more-link-custom" href="/articles/{ $article->id }"><span><i>更多</i></span></a>
        </div>
    </div>
</article>
       @endforeach
       {!! $articles->render() !!}
@endsection

article.blade.php是页面展示的布局,在views/文件夹根目录下
article.blade.php:

<html class="no-js" lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Articles</title>
    <link rel='stylesheet' href="/css/all.css" type='text/css' media='all'/>
    <script type='text/javascript' src="/js/all.js"></script>
    <link rel='stylesheet' href="/css/bootstrap.min.css" type='text/css' media='all'/>
    <link rel='stylesheet' href="/css/select2.css" type='text/css' media='all'/>
    <script src="/js/jquery-2.1.4.min.js"></script>
    <script src="/js/select2.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
</head>
<body>
<div id="wrapper">
        <div class="container">
            <section class="content">
                <div class="pad group">
                    @yield('content')
                </div>
            </section>
        </div>

    <nav class="nav-container group" id="nav-footer">
        <div class="nav-wrap">
            <ul class="nav container group">
                <li class="menu-item">
                    <a href="/" rel="nofollow" target="_blank">Laravel 5 Blog</a>
                </li>
            </ul>
        </div>
    </nav>
</div>
</body>
</html>

因为views/articles/index.blade.php的代码是跟tags/show.blade.php的代码一样的
tags/show.blade.php

<!DOCTYPE html>
<html class="no-js" lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Articles</title>
    <link rel='stylesheet' href="/css/all.css" type='text/css' media='all'/>
    <script type='text/javascript' src="/js/all.js"></script>
    <link rel='stylesheet' href="/css/bootstrap.min.css" type='text/css' media='all'/>
    <link rel='stylesheet' href="/css/select2.css" type='text/css' media='all'/>
    <script src="/js/jquery-2.1.4.min.js"></script>
    <script src="/js/select2.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
</head>
<body>
<div id="wrapper">
        <div class="container">
            <section class="content">
                <div class="pad group">
                    @yield('content')
                </div>
            </section>
        </div>

    <nav class="nav-container group" id="nav-footer">
        <div class="nav-wrap">
            <ul class="nav container group">
                <li class="menu-item">
                    <a href="/" rel="nofollow" target="_blank">Laravel 5 Blog</a>
                </li>
            </ul>
        </div>
    </nav>
</div>
</body>
</html>
@extends('articles')
@section('content')
      @foreach($articles as $article)
<article class="format-image group">
    <h2 class="post-title pad">
    <a href="/articles/{ $article->id }"> { $article->title }</a>
    </h2>
    <ul class="post-meta pad group">
        <li><i class="fa fa-clock-o"></i>{ $article->published_at->diffForHumans() }</li>
        @if($article->tags)
            @foreach($article->tags as $tag)
                <li><i class="fa fa-tag"></i><a href="/articles/tags/{ $tag->name }">{ $tag->name }</a></li>
            @endforeach
        @endif
        <li><i class="fa fa-eye"></i>{ count($article->visitors) } 浏览</li>
        <li><i class="fa fa-comments"></i><a target="_blank" href="##">{ count($article->comments) } 评论</a></li>
    </ul>
    <div class="post-inner">
        <div class="post-deco">
            <div class="hex hex-small">
                <div class="hex-inner"><i class="fa"></i></div>
                <div class="corner-1"></div>
                <div class="corner-2"></div>
            </div>
        </div>
        <div class="post-content pad">
            <div class="entry custome">
                { $article->intro }
            </div>
            <a class="more-link-custom" href="/articles/{ $article->id }"><span><i>更多</i></span></a>
        </div>
    </div>
</article>
     @endforeach
       <!--{!! $articles->render() !!}-->
@endsection

articles.blade.php是存在的,因为views/articles/index.blade.php是可以正常显示的

不知道为什么tags/show.blade.php并没有嵌套在articles.blade.php

代码跟articles/show.blade.php一样的,@endsection完整

@JellyBool 将你这句话读了几遍还是有点不明白,先解析的是上面的路由的话,/article/tags还是在'article/tags/{name}上面啊,这样的话跟article/{id}有什么关联?

又出现了一个很苦恼的问题,弄了10几分钟弄不出来
我将article/tags改成了articles/tags

结果就

我的Tagscontroller:

@JellyBool 还是觉得消息提示应该改一下,比如说我发了这张贴,别人发表了一条评论,我会有两条消息提醒,但是点进来的时候,应该同时消去指向同一条评论的消息,你觉得这样如何?