2015-01-28 2 views
1

내 Laravel 프로젝트에서 사용자의 프로필 페이지를 표시하도록 경로를 설정했습니다.보기가 올바르게 표시되지 않습니다. Laravel

Route::get('{id}', ['as' => 'profile', 'uses' => '[email protected]']); 

모든 경로가이 경로로 표시됩니다. 그러나, 나는이 작업을 수행 할 때

Route::get('profile/{id}', ['as' => 'profile', 'uses' => '[email protected]']); 

로 경로를 변경하고 my.app:8000/profile/1 내 CSS로 이동하여 HTML 괜찮 싶지만 깨진 이미지 링크를 얻을 내 JQuery와 더 이상도

I 작동 나는 내 이미지뿐만 아니라 jQuery를로드 src="{{URL::asset("images/users/xxxxxxx")}}"을 사용하고

Route::get('/profile/{id}', ['as' => 'profile', 'uses' => '[email protected]']); 

을 시도 내 경로 파일에 내가 공의 경로를해야합니까 다른

없음

내가 무엇을 할 수 있는지 잘 모름. 누구든지이 문제에 대한 해결책을 알고 있습니까?

편집 :

여기 내 HTML입니다 :이 당신의 JS/이미지 경로가 아닌 Laravel의 문제라고 생각

<!doctype html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
      <!--Main Style Sheet--> 
      {{ HTML::style('css/style.css'); }} 
      <!-- JQuery --> 
      <script src="/jquery/jquery-1.11.0.js"></script> 
</head> 

<body class="main-body"> 
<!-- this image works now that i added the leading/--> 
<img src="{{ URL::asset("/images/users/{$user->id}/profilePictures/176thumb-{$user->profilePicture->url}") }}" alt="{{ $user->first_name }} {{ $user->last_name }} Profile Picture" width="176" height="176"> 

<!-- the jQuery For this is not working --> 
<ul class="list-grid"> 
    <li> 
     <div class="profile-example"> 
      <div class="add-box"></div> 
     </div> 
    </li> 

</ul> 

<!-- Include woodmark. This is the jquery plugin that isn't working --> 
<script src="/jquery/jquery.wookmark.js"></script> 
<!--Woodmark settings--> 
<script type="text/javascript"> 
    (function ($){ 
     $(function() { 
     var $handler = $('.list-grid li'); 

     $handler.wookmark({ 
      // Prepare layout options. 
      align: 'center', 
      autoResize: true, 
      comparator: null, 
      container: $('html'), 
      direction: undefined, 
      ignoreInactiveItems: true, 
      itemWidth: 560, 
      fillEmptySpace: false, 
      flexibleWidth: true, 
      offset: 8, 
      onLayoutChanged: undefined, 
      outerOffset: 0, 
      possibleFilters: [], 
      resizeDelay: 50, 
      verticalOffset: undefined 
     }); 
     }); 
    })(jQuery); 
    </script> 

</body> 
</html> 

답변

1

. 이 방법으로 리소스를 호출 할 때 루트에 있다면

<script src="jquery/jquery.js> 
<img src="img/image.jpg"> 

, 그것은 http://example.com/img/image.jpg를 찾습니다 : 당신이 jQuery를/이미지 같은 것을 포함 할 때 상대 경로를 사용하고있는 것 같은데 수준이지만, /profile이면 http://example.com/profile/img/image.jpg을 찾을 것입니다. 당신의 CSS는 괜찮

<script src="/jquery/jquery.js> 
<img src="/img/image.jpg"> 

경우에, 나는 당신이 이미 절대 경로를 사용하고 의심 : 당신이 앞에 슬래시를 추가하는 경우

은 항상 웹 루트의 경로를 시작합니다.

+0

가 그래 난이 있었나요 작동을 사용하는 자사의 "IMG/image.jpg를"로 및 "JQuery와/jquery.js ". "/img/image.jpg"& "/jquery/jquery.js"로 변경했지만 여전히로드되지 않습니다 – xslibx

+0

@xslibx HTML plz을 표시 할 수 있습니까? 특히 리소스가 포함되는 부분과 우리가 볼 수있는 URL을 언급하십시오. – mopo922

1

내가

{{ HTML::script('jquery/jquery.js'); }} 

대신

<script src="/jquery/jquery.js"></script> 

지금은 모든 것이

관련 문제