Full page caching cause some weird situations

Permalink 4 users found helpful
Hi
I do have a site which has a decent amount of custom coding. i.e. in header.php it has some custom code to show whether a user is logged in or not. If not, it shows welcome guest & some normal cms links. but if a user is logged in, it shows user info, logout link, some important page links, create blog links and many more.

Everything seems to be working fine if I disabled the full page caching. But if it is enabled then the problem occurs.

Here is the scenario: Suppose I'm logged in and navigate to another page, the header shows the non logged in links. But the session doesn't expires as if I refresh the page, it shows the logged in info. Same thing happened for other pages.

Note: I'm 100% sure about the coding, its absolutely okay. no bug is there.

is there a way to solve this. If I disable the cache, the loading time will increase which I won't let it happen.

Please help me.

Rony

ronyDdeveloper
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
The full page cache isn't intended to cope with such code. Its one of the things that comes out in discussion in the leaders forum at:

http://www.concrete5.org/developers/pro-accounts/community-leaders-...

This thread also touches on the full page cache, but is more concerned with the block cache
http://www.concrete5.org/community/forums/documentation_efforts/spe...
JohntheFish replied on at Permalink Reply
JohntheFish
The only way I know to have the full page cache and get round such issues is to insert the info using JavaScript, possibly with ajax callbacks. However, unless you are very careful doing that could open up security holes. Also, it could become a big new overhead that kind of defeats the intention of using the full page cache.
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
Thanks for your reply. It looks like it will be a headache for me as the site is ready. Now if I'm going to make it through javascript or Ajax callback, it can create another problem. Is there a way to make the site fast without full page caching. Like can I make the main wrapper div to be cached?

Rony
MoonGrab replied on at Permalink Reply
MoonGrab
Just set caching on a per-block basis.
Similar stuff, such as pagination and other dynamic elements, are known not to work with full caching enabled. It's not a bug, just a behavior thing.

Enable full caching wherever the blocks on the page allow it, not in all cases.
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
great. But whats about the static php code that I've written down in header?

Rony
JohntheFish replied on at Permalink Reply
JohntheFish
With full page caching, your header only gets executed when the cache is filled.
MoonGrab replied on at Permalink Reply
MoonGrab
It caches your header so I guess this answers your question.
Try to create a block from it.

PS: kinda funny to use the term "static PHP code" :)
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
Thanks MoonGrab. I'll try to create a block.

And sorry for the typo, its more likely Hard coded rather static, :)

Rony
mkly replied on at Permalink Reply
mkly