合并的templete没有显示完整的结果laravel

时间:2017-11-13 02:47:44

标签: laravel include

我在将两个模板组合在一起时遇到了一些麻烦,我希望弹出按钮与用户信息一起显示。当我尝试这样做时,它只显示内部的一些信息而不是全部。这是为什么?

背景信息:我正在尝试创建一个显示用户信息的页面,还有一个按钮,当用户点击它时,他们可以在里面提交一些细节。但由于某些原因,当我将它们组合在一起时,它或者只是显示一些信息而没有按钮,或显示更小的信息但是带有按钮。

以下是弹出按钮的代码:

evaltest.blade.php(我希望这里显示来自test.blade.php的信息,但现在只显示了一些信息)

didUpdateLocations

test.blade.php(里面有更多信息,但我只把一些信息作为我获取信息的例子)

    <html>
    <head> 
        <title>Popup form </title>
        <meta name="robots" content="noindex, nofollow">    
        <link href="{{ asset('css/elements.css') }}" rel="stylesheet">
        <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-43981329-1']);
        _gaq.push(['_trackPageview']);
        (function () {
        var ga = document.createElement('script');
        ga.type = 'text/javascript';
        ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
        })();
    </script>
    </head> 
     <!-- body starts here -->
     <body id ="bdy" style="overflow:hidden;">

     <div id="abc">

         <!-- Popup div starts here -->
     <div id="popupContact"> 

        <!-- contact us form -->
             <form class="form-horizontal" method="post" action="{{ url('/evaltest/'.$data0->id) }}">
            {{ csrf_field() }}
            <img id ="close" src="{{ URL::to('/image') }}/3.png" onclick ="div_hide()">
             <input type="hidden" name="user_id" value="{{$data0->id}}">

         <div class="form-group">
            <label class="col-md-2"><b>Recommendation:</b></label>
          <div class="col-md-6">
            <input type="radio" id ="recommendation" name="recommendation" value="Yes"> Yes<br>
            <input type="radio" id ="recommendation" name="recommendation" value="No"> No<br>
          </div>
      </div>
            <div class="form-group">
                <div class="col-md-6-offset-2">
                  <input id= "submit" type="submit" href="javascript: check_empty()" class="btn btn-primary" value="Save">
                </div>
              </div>
            </form>
     </div> 
    <!-- Popup Div Ends Here -->
    </div>
    <!-- Display Popup Button -->
//this will show a few info but no button       
@include('test')
    <h1>Click Button to Evaluate</h1>
    <button id="popup" onclick="div_show()">Popup</button>
        <script src="{{ asset('/js/my_js.js') }}"></script>
//this will show even lesser info but button is shown
//@include('test')
    </body>
    </html>

1 个答案:

答案 0 :(得分:1)

您应该在调用$data的地方传递@include变量。例如@include('test',[$data])

希望这会有所帮助:)