Codeigniter を学習しようとしています。CI サイトのチュートリアルに従って、簡単な MVC を作成しました。これは私のコントローラーです...
<?php
class Pages extends CI_Controller {
public function view($page = 'home'){
if(!file_exists(APPPATH.'/views/pages/'.$page.'.php')){
show_404();
}
$data['title'] = ucfirst($page);
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
}
これがヘッダーテンプレートです...
<html>
<head>
<title><?php echo $title ?> - WurkWithUs</title>
<link rel="stylesheet" href="http://localhost/ci/CodeIgniter_2.1.2/css/bootstrap.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://localhost/ci/CodeIgniter_2.1.2/css/custom.css" type="text/css" media="screen"/>
</head>
<body>
<h1>Wurk With Us</h1>
上記のような絶対パスを使用すると、スタイル シートが機能します。ただし、次のようなものを使用しようとすると...
<link rel="stylesheet" href="<?= base_url()?>css/bootstrap.css" type="text/css" media="screen"/>
空白のページが表示されます。「ページのソースを表示」すると、スタイルラインは次のようになります...
<link rel="stylesheet" href="
ここでの提案に従おうとしましたが、同じ結果が得られました。つまり、ドキュメントは "href=" 行で解析されなくなりました。
私は何を間違っていますか?スタイルシートをロードするより良い方法はありますか?