Welcome Guest, Not a member yet? Register   Sign In
Strange behaviour where page loads but images do not show up
#1

[eluser]notresponsible42[/eluser]
I hope someone can help me...

I am getting inter-mitten weirdness when trying to access functions in a controller. Example = http://transitnews.info/sign_up_1/login/1, where 'sign_up_1' is the page/controller name, 'login' the function I am calling and '1' is the parameter I am passing.

The page will load but the images will not. Checking the page source, I don't see any issues with the image pathing. I have the exact same format and calls coded for the some backend pages and the problems doesn't exist.

I have set up an example page so you can see what I mean. http://transitnews.info/example/login/1. Yet http://transitnews.info/example works. And, as I have said the exact same configuration works in other code written for the backend.

Here's the controller code:

class Example extends Controller {

function Example()
{
parent::Controller();
}

function index()
{
$data['pagetitle'] = "Example";
$data['section'] = "Example";
$data['left_col_place'] = "example";

$this->load->database();

$this->load->view('header', $data);
$this->load->view('example');
$this->load->view('footer');
}

function login($pid)
{
$data['pagetitle'] = "Example";
$data['section'] = "Example";
$data['left_col_place'] = "example";

$this->load->database();

$this->load->view('header', $data);
$this->load->view('example');
$this->load->view('footer');
}
}

Anybody seen this before? Thanks.
#2

[eluser]WanWizard[/eluser]
When I try to load one of the images directly ( http://transitnews.info/example/login/sy...e_over.jpg ), I get your controller page. Which means this URL gets rewritten to load the index.php.
Check your rewrite rules.

It's usually easier to create an 'assets' directory in the root, and store all your assets there, so you can use one single rewrite condition to exclude it. If you store them amongst your code, you either have to do something smart (like excluding all URL's with /image/ in the path) or exclude based on extension.
#3

[eluser]notresponsible42[/eluser]
I am a first time CI user and new to whole URL modification concept and process.

I am in an advanced stage of development with a looming deadline and I think it is too late at this point to change how I organized the assets. But I read this same advice in the documentation when I started. I just ignored it at that time, not appreciating the value.

Can you help a slughead like me and give me an example of how to "exclude all URL's with /image/ in the path"? Here's what I have now:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

I usually can extrapolate what's going on once I see the code.

Thanks in advance for your help.
#4

[eluser]notresponsible42[/eluser]
Nevermind. I found a workaround. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB