Welcome Guest, Not a member yet? Register   Sign In
always problem with image path!
#8

[eluser]Unknown[/eluser]
Hi, I've spent the last, say, 3 hours of my time trying to figure this out - and I believe I've found the solution! I tested it on my development installation and it seems to work fine.

I found this .htaccess code on another thread. I tested it and it works:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Now how does this work? Well this is what I did:
1. create "css" and "img" folders in the system/application directory
2. put all your css and imgs into those folders, respectfully
3. when attaching a stylesheet, attach it this way (where "main_default.css" is your css file):
<link type="text/css" rel="stylesheet" href="<?php echo base_url(); ?>system/application/css/main_default.css " media="screen" />

4. regarding image path names, in css follow this example for a background image:
body {
margin: 0px;
padding: 0px;
background-image: url(../imgs/bg.jpg);
background-repeat: repeat;
}
5. again, regarding image path names, in html view files follow this example:
<body>
<span class="txt1">HELLO!</span>
&lt;?php echo img('system/application/imgs/bg.jpg'); ?&gt;
&lt;/body&gt;

I hope this helps. It helped me a lot.


Messages In This Thread
always problem with image path! - by El Forum - 12-13-2009, 07:59 AM
always problem with image path! - by El Forum - 12-13-2009, 10:01 AM
always problem with image path! - by El Forum - 12-13-2009, 10:29 AM
always problem with image path! - by El Forum - 12-13-2009, 11:42 AM
always problem with image path! - by El Forum - 12-13-2009, 12:26 PM
always problem with image path! - by El Forum - 12-16-2009, 04:52 PM
always problem with image path! - by El Forum - 12-16-2009, 05:35 PM
always problem with image path! - by El Forum - 02-19-2010, 10:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB