CodeIgniter Forums

Full Version: images not viewed when going to other pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]rochellecanale[/eluser]
hey guys i have a big problem.
The problem is i created an image folder and this is the folder where i put all my images.
And when i load it in my view the first loading is fine. but when i attempt to go to the other pages it is not viewing anymore. i uses anchor tag to redirect my pages.
i created a header and footer. and there i put an image of header, etc... and a navigation menu. When i clicked the navigation menu my header images is not viewing together with the css.

El Forum

[eluser]deqer[/eluser]
you need to show us your code. use a paste service website to show your code.

El Forum

[eluser]rochellecanale[/eluser]
my Controller
==========================================================================================
<?php

class HomePage extends CI_Controller{

public function __construct(){
parent::__construct();
$this->load->helper(array('form','html','url'));
$this->load->library('form_validation');
}

public function index(){
$data['title'] = "Welcome to eload Multi Level Marketing!!";

$this->form_validation->set_rules('username','Username','required|xss_clean');
$this->form_validation->set_rules('password','Password','required|md5');

if($this->form_validation->run() == FALSE){
$this->load->view('templates/header',$data);
$this->load->view('sites/login');
$this->load->view('templates/footer');
}else{
$this->load->view('templates/header');
$this->load->view('sites/sucess');
$this->load->view('templates/footer');
}
}

public function addNewMember(){
$data['title'] = "Create your own Free Account Now!!!";
$this->load->view('templates/header',$data);
$this->load->view('sites/addNewMember');
$this->load->view('templates/footer');
}
}

?>

El Forum

[eluser]rochellecanale[/eluser]
my header
=============================================================================
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html lang="en"&gt;

&lt;head&gt;
&lt;meta name="distribution" content="global" /&gt;
&lt;meta name="description" content="Your page description here ..." /&gt;
&lt;meta name="keywords" content="Your keywords, keywords, keywords, here ..." /&gt;
&lt;link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout1_setup.css" /&gt;
&lt;link rel="stylesheet" type="text/css" media="screen,projection,print" href="./css/layout1_text.css" /&gt;
&lt;link rel="icon" type="image/x-icon" href="./img/favicon.ico" /&gt;
&lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;!-- Global IE fix to avoid layout crash when single word size wider than column width --&gt;
&lt;!--[if IE]>&lt;style type="text/css"&gt; body {word-wrap: break-word;}&lt;/style&gt;&lt;![endif]--&gt;

&lt;body&gt;
&lt;!-- Main Page Container --&gt;
<div class="page-container">

&lt;!-- For alternative headers START PASTE here --&gt;

&lt;!-- A. HEADER --&gt;
<div class="header">

&lt;!-- A.1 HEADER TOP --&gt;
<div class="header-top">

&lt;!-- Sitelogo and sitename --&gt;
<a class="sitelogo" href="#" title="Go to Start page"></a>
<div class="sitename">
<h1><a href="index.html" title="Go to Start page">Welcome to eload Multi Level Marketing</a></h1>
<h2><i>http://emlmproj.com.ph</i></h2>
</div>

&lt;!-- Navigation Level 1 --&gt;
<div class="nav1">
<ul>
<li><a href="#" title="Go to Start page">Home</a></li>
<li><a href="#" title="Get to know who we are">About</a></li>
<li><a href="#" title="Get in touch with us">Contact</a></li>
<li><a href="#" title="Get an overview of website">Sitemap</a></li>
</ul>
</div>
</div>

&lt;!-- A.2 HEADER MIDDLE --&gt;
<div class="header-middle">

&lt;!-- Site message --&gt;
<div class="sitemessage">
<h1> &bull; COST FRIENDLY </h1>
<h1>&bull; SECURED </h1>
<h1>&bull; SUCCESS</h1>
<h2>"Where success begins"...</h2>
</div>
</div>

&lt;!-- A.3 HEADER BOTTOM --&gt;
<div class="header-bottom">

&lt;!-- Navigation Level 2 (Drop-down menus) --&gt;
<div class="nav2">

&lt;!-- Navigation item --&gt;
<ul>
<li><a href="index.html">HOME</a></li>
</ul>

&lt;!-- Navigation item --&gt;
<ul>
<li><a href="#">PRODUCTS&lt;!--[if IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;
<ul>
<li><a href="layout1.html">Layout-1 (1-col)</a></li>
<li><a href="layout2.html">Layout-2 (2-col)</a></li>
<li><a href="layout3.html">Layout-3 (2-col)</a></li>
<li><a href="layout4.html">Layout-4 (3-col)</a></li>
<li><a href="layout5.html">Layout-5 (3-col)</a></li>
</ul>
&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
</ul>

&lt;!-- Navigation item --&gt;
<ul>
<li><a href="#">PRODUCTS GALLERY&lt;!--[if IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;
<ul>
<li><a href="header1.html">Header-1 (T+M+B)</a></li>
<li><a href="header2.html">Header-2 (T+M)</a></li>
<li><a href="header3.html">Header-3 (T+B)</a></li>
<li><a href="header4.html">Header-4 (M+B)</a></li>
<li><a href="header5.html">Header-5 (T)</a></li>
<li><a href="header6.html">Header-6 (M)</a></li>
<li><a href="header7.html">Header-7 (B)</a></li>
</ul>
&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
</ul>

<ul>
<li><a href="#">BRANCHES/LOCATION&lt;!--[if IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;
<ul>
<li><a href="header1.html">Header-1 (T+M+B)</a></li>
<li><a href="header2.html">Header-2 (T+M)</a></li>
<li><a href="header3.html">Header-3 (T+B)</a></li>
<li><a href="header4.html">Header-4 (M+B)</a></li>
<li><a href="header5.html">Header-5 (T)</a></li>
<li><a href="header6.html">Header-6 (M)</a></li>
<li><a href="header7.html">Header-7 (B)</a></li>
</ul>
&lt;!--[if lte IE 6]></td></tr></table></a><![endif]--&gt;
</li>
</ul>

<ul>
<li><a href="#">ABOUT US&lt;!--[if IE 7]>&lt;!--&gt;</a>&lt;!--<![endif]--&gt;
&lt;!--[if lte IE 6]><table><tr><td><![endif]--&gt;
<ul>
<li><a href="header1.html">Header-1 (T+M+B)</a></li>
<li><a href="header2.html">Header-2 (T+M)</a></li>
<li><a href="header3.html">Header-3 (T+B)</a></li>
<li><a href="header4.html">Header-4 (M+B)</a></li>
<li><a href="header5.html">Header-5 (T)</a></li>
<li><a

El Forum

[eluser]deqer[/eluser]
Hmm, I think your issue is this:

href=”./css/layout1_setup.css”

That "." means {current folder}

You want to remove the "." and keep the root "/" there.

Like so:
href="/css/layout1_setup.css"

El Forum

[eluser]TWP Marketing[/eluser]
Also, please use the [ code][ /code] formatting tags when you post code. It makes it much easier for us to read.

As deqer pointed out, the leading period in the path is a problem ie:
Code:
&lt;link rel=“icon” type=“image/x-icon” href=”./img/favicon.ico” /&gt;
Should be:
Code:
&lt;link rel=“icon” type=“image/x-icon” href=”/img/favicon.ico” /&gt;

El Forum

[eluser]Abdul Malik Ikhsan[/eluser]
I think, for dinamic url, pass after base_url() func
Code:
&lt;link rel=“icon” type=“image/x-icon” href=”&lt;?php echo base_url(); ?&gt;img/favicon.ico” /&gt;