CodeIgniter Assistance Please

Status
Not open for further replies.

obrienm

Wise, Aged Ars Veteran
120
Hi all

I'm developing a site with CodeIgniter and am finding that my page "refreshes" aren't always, if ever, reflecting changes in my database.

To be specific, if I'm working in my administration section and add a few items to the database (it's a music zine with lots of reviews) and then log out of that section I have a redirect in the controller (with the optional 'refresh' parameter specified) in place that sends me back to the site root which itself is a totally different controller. When this happens, however, any new content that has been generated is not automatically shown unless I physically refresh the page.

My initial suspicion was that there might've been some kind of caching turned on but that doesn't seem to be the case. I've also gone as far as nulling my data array in the site root controller before trying to retrieve the data from my model again but that does nothing either. It feels to me like the instantiated controller objects are persisting until I physically intervene and force them to regenerate which is a bit of a pain really.

Is there something simple about the way CI works that I'm missing here?

Cheers.
 

obrienm

Wise, Aged Ars Veteran
120
Sessions are being used only within the admin section and only to track user credentials and the like.

Unfortunately the problem exists independent of sessions. So like, if I were a visitor to the site and had been viewing a particular section and in the meantime new content had been added I might click on the logo or home link or what have you but I will not see these new changes when I reach the front page (or any page that has been modified for that matter).
 

elvispresly2k

Ars Scholae Palatinae
1,411
obrienm":10zpk6sx said:
Sessions are being used only within the admin section and only to track user credentials and the like.

Unfortunately the problem exists independent of sessions. So like, if I were a visitor to the site and had been viewing a particular section and in the meantime new content had been added I might click on the logo or home link or what have you but I will not see these new changes when I reach the front page (or any page that has been modified for that matter).


Sorry about your problem. I've not seen this issue myself. Are you using CI's Models for DB interaction ? (I assume you are.) If so, try removing the model from the equation--just do raw php db interactions directly from the controller to see if the issue remains. Might help narrow down the problem?
 

philh

Smack-Fu Master, in training
84
It sounds to me like you have some caching going on -somewhere-, whether thats as a php/apache-iis-nginx-whatever extension in your server, within CI, or your browser.

As the changes seem to be taking, just not showing until you hit refresh, that says to me the page is being cached.

Edit: With regards to CI v2, make sure if you are using a MY_Controller that you extend CI_Controller and not just controller.
 

obrienm

Wise, Aged Ars Veteran
120
I did a bit more playing with this yesterday and, interestingly (and somewhat annoyingly), it would appear that my dev box is actually fine but it is the live server that is having the issue.

Being that I'm using exactly the same code on each (and am accessing from the same machine/browser) I'm leaning towards it being an Apache issue... somehow. I'm not overly knowledgeable about Apache short of mucking around with the conf file. Is there anything buried away in there that sounds even remotely likely to be caching that anyone is aware of?

As far as the issues with CI 2.0, I ran through the upgrade instructions and adjusted the names of the base classes. My issue was that it refused to look for my Application directory outside of the System directory. I finally resorted to putting the full path of the Application directory into the index file and it kinda looked like it would work eventually but I gave it away in favour of doing a few more tests with my "proven" install.
 
Status
Not open for further replies.