2013-04-20 2 views
0

이 질문은 여러 번 질문되었지만 제 프로젝트에서 올바르게 작용하는 답변을 찾지 못했습니다. 나는 또한 BASE_URL href="<?php echo base_url('assets/css/style.css');?>"를 사용하여 CSS를 연결하는 시도했지만 나를 위해 작동하지 않습니다스타일 CSS가 CodeIgniter - Baseurl을 사용하지 않음

-main_directory 
    -Application 
    -Assets 
    -css 
     -style.css 
    -System 

:에

<link rel="stylesheet" type="text/css" href="assets/css/style.css"/> 

CSS 파일을 좋아하는 내 CSS 파일입니다.

그래서 무엇이 문제입니까? 누구든지 도와 줄 수 있습니까?

+0

는 http://stackoverflow.com/questions/6630770/where-do-i-put-image-files-css-etc-in-code-igniter –

+0

이 유 URL 헬퍼로드 한 참조? –

+0

일부 답변이 유용하다고 판단되면 답변을 수락하도록 연습하십시오. –

답변

1

귀하의 구조는 이제 config/autoload.php

$autoload['helper'] = array('url'); 

<link href = '<?php echo base_url()?>/assets/css/style.css'> 

이 작동합니다이

myproject 
    application 
    assets 
    css 
     style.css 
system 

자동로드 URL 도우미처럼해야한다. 철자가 올바른지 확인하고 Linux를 사용하는 경우 casd 민감한 문제를 확인하십시오.

+0

감사합니다, 그 절대적으로 잘 작동합니다. – ChitranjanThakur

0
Try this once - 
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/style.css" /> 
+0

감사합니다, 그 절대적으로 잘 작동합니다. – ChitranjanThakur

1

제대로 base_url() 메소드가 설정되어 있습니까? 당신은 C에있는 경우 ... 여기

ci_app_folder/config/config.php 

을 확인 :/XAMPP/htdocs에/ci_app_name

$config['base_url'] = 'localhost/ci_app_name'; //or localhost:90/ci_app_name if you had changed port 

은 그럼 당신은 (이

<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/css/style.css'); ?>" > 

당신도 설정할 수 있습니다 BASE_URL을 사용할 수 있습니다) 비어 있습니다. 웹 호스팅/서버에 업로드하지 않은 경우.

0

이 같은 사용자 정의 CSS 링크를 배치 할 수 있습니다 :

background-image:url(../../); moving back to the directory you want 

당신이 인라인 CSS를 사용할 필요가 CI를 사용 : 예.

<div style = background-image: url(<?php echo base_url();?>)assets/images/> 
    </div> 
관련 문제