I have two controllers in my project. The second controller do not displays in right way. If I open it with in browser line – thats ok, but if i pass it by the link in view its not ok. The second controller resembles on 1st.
Controller(s)
<?php
if ( ! defined('BASEPATH')) exit ('No direct script access allowed');
class Article extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
ini_set('display_errors',1);
error_reporting(E_ALL);
$this->load->view('header_view');
$this->load->view('menu_view');
$this->load->view('categories_view');
$this->load->model('mat_model');
$data = array();
$data['news'] = $this->mat_model->get_latest();
$data['latest'] = $this->mat_model->get_latest();
$this->load->view('useful_sites_view',$data);
$this->load->view('article_view',$data);
$this->load->view('footer_view');
}
}
?>
The view where I have a link:
<?php foreach ($news as $one):?>
<div id="right">
<div id="breadcrumb"><a href="">Home</a> » <a href="">Somewhere</a></div>
<h1><?=$one['title']?></h1>
<p>
<div id="small_img"><?=$one['small_img']?></div>
<?=$one['description']?>
</p>
<div id=""> <a href="<?=base_url()."article/index/".$one['material_id'];?>" class="postinfo2">Читать далее...</a></div>
<span class="postinfo"> Posted by <a href=""><?=$one['author']?></a> on
<?=$one['date']?></span>
<HR ALIGN="center" WIDTH="70%" SIZE="1px" COLOR="black">
</div>
<?php endforeach; ?>
I dont have so much reputation to browse images on the site, but i needs it so much, apologize for using otherwise resource
With line in browser:
With the link:
http://s020.radikal.ru/i710/1301/fd/76f313259454.jpg
With the browser line:
http://s020.radikal.ru/i713/1301/4e/a863cd18184d.jpg
Thanks.
In reply to the comment above…
is an absolute path.
Lets say that your
base_url()is'http://www.example.com/'so the above line will link to your css like so:so no matter which page you’re on, the CSS will always be linked to that css file.
On the other hand if you were using relative paths like this:
on your site root, the css path would be correct. BUT on some other page, for example
your CSS would be linked like this:
which is obviously, wrong.
Try to google relative and absolute paths in html, that should make things a lot clearer.