Some classes load twice! |
[eluser]Razican[/eluser]
Hello, I'm trying to work with JQuery and CodeIgniter 2.0 (latest rev. in repo.) I have logs on, and have noticed that some classes load twice. Moreover, I'm doing an AJAX request and the result changes even if I'm not requesting it. For example, If I request a query, with num_rows() = 1, it starts to blink the 1 after finishing the request. But the main problem is the double loading. I have separated each request for you to see it better. Code: DEBUG - 06-12-2010 20:31:40 --> Config Class Initialized Code: DEBUG - 06-12-2010 20:31:46 --> Config Class Initialized The Model class loads twice, or even more times. On the other hand, the XSS Filtering loads also twice. How can I solve it?
[eluser]WanWizard[/eluser]
Do you have a rewrite rule in place that rewrites everything that does not exist to index.php (the famous -f and -d rules)? If you, you might have an asset missing (image, js file, etc), that causes a second rewrite to index.php.
[eluser]Razican[/eluser]
This is my .htaccess file: Code: # Deny OR Allow Folder Indexes. It worked fine with CodeIgniter 1.7.2, and with the first rev.s in the repo. 2.0.
[eluser]WanWizard[/eluser]
As I said, the famous -d and -f rules: Code: RewriteCond %{REQUEST_FILENAME} !-f As I've repeated here over and over again: DO NOT USE THIS! Instead, create an assets folder, and store all your assets in there, then exclude that entire folder from rewriting. Better a 404 on an asset, than this (which can take hours and hours of work to discover the error).
[eluser]Razican[/eluser]
I don't know much about .htaccess. I have my images in /images folder, javascript in /javascript and css in /css. How can I exclude them?
[eluser]WanWizard[/eluser]
This should work Code: RewriteCond $1 !^(images|javascript|css)
[eluser]Razican[/eluser]
I have changed the .htaccess file to look like this: Code: # Deny OR Allow Folder Indexes. But now I get a 404 error every time.
[eluser]WanWizard[/eluser]
Maybe in your case $1 sould be %{REQUEST_URI} (you seem to need that in all other conditions).
[eluser]Razican[/eluser]
It doesn't work with %{REQUEST_URI}... I don't know what could be the problem...
[eluser]WanWizard[/eluser]
I can't look into your environment, so it's very difficult for me to give you the correct config. What you can do as a temporary measure, add Code: log_message('debug', "URL requested: ".$_SERVER['REQUEST_URI']); It will log every URL requested to the log file. That would help you to find which assets are missing. |
Welcome Guest, Not a member yet? Register Sign In |