[eluser]sikko[/eluser]
Hi everyone,
I'm stuck for days now...
Ajax
I'm working on a website that works entirely in Ajax.
As you may know, when requesting an ajax page, we don't need to load header and footer stuff, just the content.
SEO
However, for this website to still be indexed by search engines, I allow the pages to be accessed directly, including header and footer.
To avoid loading header and footer on ajax requests, I pass a flag on every ajax request, and if this flag is present, don't display them.
Caching
Everything works fine until I try to activate page caching.
When an ajax page is cached, header and footer stuff are not cached, and if you try to access the page directly, you get a non-styled page with only the data, no header, no footer.
Same problem when a non-ajax page is cached, and later called by ajax, header and footer are displayed INTO the current page... [Not easy to explain sorry.]
My try
I tried to use Hooks to capture the output and surround it with header and footer:
- display_override (this hook point works well, but ignores the cache)
- cache override (can't call the $CI &= get_instance from this hook point, so can't call my header and footer...)
Now I'm just wondering if hooks are the best solution to do this...
Am I forced to use full ajax ?
Yes... this is a music website so the music has to continue when a link is clicked...
Any help or advice would be really appreciated...
Thank you in advance, and sorry for that long post.