Welcome Guest, Not a member yet? Register   Sign In
Stylesheet modified by CI
#1

[eluser]CyberGirl[/eluser]
Hello everyone,

I just download CodeIgniter 2.0.0 and when I run it everything works fine. However when I take the styles from the welcome_message.php and put them in an external stylesheet the view is shown in the browser without formatting.
When I click the link to the stylesheet in the browser the stylesheet looks like this.
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;title&gt;Object not found!&lt;/title&gt;
&lt;link rev="made" href="mailto:postmaster@localhost" /&gt;
&lt;style type="text/css"&gt;&lt;!--/*--&gt;&lt;![CDATA[/*>&lt;!--*/
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--&gt;&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
<h1>Object not found!</h1>
<p>


    The requested URL was not found on this server.

  

    The link on the
    &lt;a href="http://localhost/projects/ci_demo/index.php">referring
    page</a> seems to be wrong or outdated. Please inform the author of
    &lt;a href="http://localhost/projects/ci_demo/index.php">that page</a>
    about the error.

  

</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.

</p>

<h2>Error 404</h2>

<address>
  &lt;a href="/">localhost</a><br />
  
  <span>12/03/2011 10:02:33<br />
  Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1</span>
</address>
&lt;/body&gt;
&lt;/html&gt;

The stylesheet is in the folder application/views.
The link in the welcome_message.php is:
Code:
&lt;link rel="stylesheet" href="default.css" type="text/css"&gt;
Does anybody know what is wrong?
#2

[eluser]Edmundas KondraĊĦovas[/eluser]
Can you show the actual contents of welcome_message.php file? Seems like you are doing something wrong.
#3

[eluser]CyberGirl[/eluser]
It is the original file + the link to the style sheet.
Code:
<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Welcome to CodeIgniter&lt;/title&gt;
    &lt;link rel="stylesheet" href="default.css" type="text/css"&gt;
&lt;/head&gt;
&lt;body&gt;

<h1>Welcome to CodeIgniter!</h1>

<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>

<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>

<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/welcome.php</code>

<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>


<p><br />Page rendered in {elapsed_time} seconds</p>

&lt;/body&gt;
&lt;/html&gt;
#4

[eluser]Edmundas KondraĊĦovas[/eluser]
The problem here is that default.css located in the application/views folder, but the browser actually looks for the stylesheet in the base directory. I usually have a seperate folder called "assets" in the main directory. So I would suggest putting default.css in assets/css folder and then refer to the stylesheet in the view like this:

Code:
&lt;link rel="stylesheet" href="&lt;?=base_url()?&gt;assets/css/default.css" type="text/css"&gt;

Just make sure to load URL helper for base_url() function.
#5

[eluser]CyberGirl[/eluser]
Hi,

great it works now Smile Smile
thanks a lot.




Theme © iAndrew 2016 - Forum software by © MyBB