Currently I am using header("Cache-Control: no-cache, must-revalidate"); in my PHP script to tell the browser to reload everything every time. But this is totally unnecessary because I only want a certain piece of code reload and have stuff such as images cached – especially because it’s a mobile page.
Is there any way to ensure images gets cached but not the text? Or anything like that?
Take Note: Javascript is not allowed.
Images are retrieved from a different HTTP request than your PHP pages, they can be cached on not the html. This page describes caching images in quite a bit of detail.
As far as caching a portion of the page, why can’t you use javascript? A reasonable approach is to cache the page till the end of time, and then make an ajax request for the non-cache-able content.