CI 묻고 답하기

제목 값 넘겨서 페이지 호출할때 css및 js가 적용되지 않는 문제
카테고리 CIBOARD
글쓴이 구구 작성시각 2017/11/08 18:50:29
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 14222   RSS

안녕하세요.

이제 막 코드이그나이터를 공부하기 시작한 초보입니다.

관리자페이지를 만들어보는중 막혀서 질문드립니다.

생활코딩 및 검색을 통해 어찌어찌 데이터베이스에 입력하고 출력하고 까지는 완성했습니다.

회원의 정보를 테이블형식으로 출력해주고 회원을 클릭했을 때 상세정보가 나오도록 하려고 합니다.

해서 회원리스트에서 한명 클릭했을때 아이디값을 넘겨서 디비에서 해당하는 아이디의 한줄을 빼오려고 하는데

디비에서 빼오기전에 일단 값이 잘 넘어가는지 테스트도중에 문제가 생겼습니다.

값은 잘 출력이 되는데 css및 js가 먹지않는것입니다.

개발자 도구의 에러는 아래와 같습니다.

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/bootstrap.min.css".jquery-3.1.1.min.js:1 Uncaught SyntaxError: Unexpected string5:25 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/dataTables/editor/editor.dataTables.css".bootstrap.js:1 Uncaught SyntaxError: Unexpected stringjquery.metisMenu.js:1 Uncaught SyntaxError: Unexpected string5:24 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/dataTables/datatables.min.css".5:18 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/toastr/toastr.min.css".jquery.slimscroll.min.js:1 Uncaught SyntaxError: Unexpected string5:21 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/js/plugins/gritter/jquery.gritter.css".5:15 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/font-awesome/css/font-awesome.css".inspinia.js:1 Uncaught SyntaxError: Unexpected stringpace.min.js:1 Uncaught SyntaxError: Unexpected string5:29 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/fullcalendar/fullcalendar.css".5:28 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/iCheck/custom.css".5:33 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css".5:37 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/custom.css".5:35 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/animate.css".5:36 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/style.css".icheck.min.js:1 Uncaught SyntaxError: Unexpected string5:343 Uncaught ReferenceError: $ is not defined    at 5:343(anonymous) @ 5:3435:30 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/hari/member_detail/index/static/css/plugins/fullcalendar/fullcalendar.print.css".

 

스타일시트가 인터프리터 되었지만 전송할때는 text/html의 형식으로 되는것 같습니다...

해당 에러의 내용으로 이것저것 검색했으나 해결하지 못하여 이렇게 올려봅니다.

 

링크로 넘긴값은 href="member_detail/index/51"  입니다.

 

 

감사합니다..

==============================

자답합니다.

함수의 파라미터로 받는것만 생각했었는데 href="member_detail?userid='userid'  이렇게 get방식으로 넘겨서 해결했습니다.

이 해결방법 말고 다른 좋은방법이 있으면 코멘트 부탁드립니다.

 다음글 cafe24에 CodeIginiter 설치하기 (3)
 이전글 codeigniter 데이터베이스 쿼리 속도 질문 드립... (11)

댓글

kaido / 2017/11/09 09:32:29 / 추천 1

URL 주소 미스 입니다.

jqeury 부터 제대로 로드되지 않아서 그 밑으로 jqeury 의존하는 애들이 줄줄이 에러를 내뱉은 상태입니다.

src 주소는 정확한 절대 주소로 full address 를 넣어주시는것이 좋습니다.

 

호출 주소를 보고 추측입니다만...

function index(){} 이 아이는 디폴트 함수같은 타입입니다.

index 말고 main 같이 다른 함수로 페이지를 만들어서 코드를 짜시면 해결 되실 것입니다.

이유는 index 는 생략이 가능 하다는 점에서 uri string 부분이 문제가 발생 합니다.

혹은 디폴트 컨트롤러 등을 설정 할 경우에도 발생 합니다.

[저 같은 경우에는 index 에는 해당 컨트롤러의 메인이 되는 곳으로 리다이렉션을 한줄 넣어둡니다.]

 

사실 페이지네이션은 개발 할때는 get parameter 가 훨씬 컨트롤이 편한 이점이 있으니 지금 다시 변경 하실 필요는 없습니다 ㅎㅎ

구구 / 2017/11/09 10:05:29 / 추천 0

index함수를 사용한 것은 다른 함수를 만들어서 했는데 같은 증상이 반복되길래..

하다하다 최종으로 놔둔 코드가 저것입니다..ㅠ_ㅠ

index에 리다이렉션 적용해보도록 하겠습니다!

답변 감사드립니다.