[eluser]artificialkid[/eluser]
Hy guys,
I´m building my first site with CI, on each page I load parts of the webpages:
1.header view(doctype, styles, javascript)
2.content of each page
3.footer view
All as going well until my Diary page (like a blog) were I use pagination to navigate between chuncks of articles, the problem happens when i click on one of the pagination links, the page loads good, but without styles or javascripts tags
the url on diary page is
http://localhost/~faustopacheco/code/diary (all shows well)
clicking on one pagination link is
http://localhost/~faustopacheco/code/diary/index/2
the error is
Code:
Error: The stylesheet http://localhost/~faustopacheco/code/diary/index/css/styles.css was not loaded because its MIME type, "text/html", is not "text/css".
Source File: http://localhost/~faustopacheco/code/diary/index/2
Line: 0
-------------
Error: syntax error
Source File: http://localhost/~faustopacheco/code/diary/index/js/jquery-1.2.min.js
Line: 1
Source Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-----
Error: syntax error
Source File: http://localhost/~faustopacheco/code/diary/index/js/functions.js
Line: 1
Source Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
my Diary controller
Code:
<?php
class Diary extends Controller {
function __construct()
{
parent::Controller();
$this->load->model('diary_model');
}
function index()
{
// load pagination class
$this->load->library('pagination');
$config['base_url'] = base_url().'/diary/index';
$config['total_rows'] = $this->db->count_all('articles');
$config['per_page'] = '2';
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$config['cur_tag_open'] = '<em>';
$config['cur_tag_close'] = '</em>';
$this->pagination->initialize($config);
//load the model and get results
//$this->load->model('books_model');
$data['results'] = $this->diary_model->get_articles($config['per_page'],$this->uri->segment(3));
// load the HTML Table Class
$this->load->library('table');
$this->table->set_heading('id', 'title', 'date', 'text','image');
$this->view->part('header', 'header/header_view');
$this->view->part('footer', 'footer/footer');
$this->view->load('diary_view',$data);
}
}
?>
the view:
Code:
<?php echo $header;?>
<div id="mainContent">
<h2>diary.</h2>
<?php echo $this->pagination->create_links(); ?>
<?php echo $this->table->generate($results); ?>
<?php echo $this->pagination->create_links(); ?>
</div>
<?php echo $footer;?>
the header view:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="design, webdesign, web 2.0, inspiration, photography, beautiful, lisbon, sun, food, gourmet" />
<meta name="description" content="Hand crafted pixels and food." />
<title>The countryside isforcows - <?php echo$this->uri->segment(1); ?></title>
<?php echo $this->config->item('css');?>
<?php echo $this->config->item('js');?>
<?php echo $this->config->item('jsfunctions');?>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1><span>The countryside isforcows</span></h1>
<div id="navigation">
<ol>
<li><a <?php if($this->uri->segment(1) =='welcome' || $this->uri->segment(1) =='' ){echo "id='current'";}?> href="welcome" title="welcome">welcome</a></li>
<li><a <?php if($this->uri->segment(1) =='about'){echo "id='current'";}?> href="about" title="about me">about</a></li>
<li><a href="[removed]void(0);" title="services">solutions</a></li>
<li><a <?php if($this->uri->segment(1) =='work'){echo "id='current'";}?> href="work" title="portfolio">work</a></li>
<li><a href="[removed]void(0);" title="contact">contact</a></li>
</ol>
</div>
</div> <!-- end header -->
is the page breaking because loading views into views?