PHP Caching Headers

Yesterday I looked at how to control browser caching with Apache’s mod_expires and today look at how to set the caching/expiry time with headers in PHP to either make sure the resulting data is never cached by the browser, or is cached for a set amount of time.

Categories PHP

jQuery: Get the vertical mid point of the browser’s window

jQuery’s $(window).height() and $(window).scrollTop() can be used to calculate the vertical mid point of a browser’s window. This quick post shows how to do this and then tomorrow’s post will look at vertically centering a Facebox dialog in the middle of the window using this method.

Different CSS style rules for printing

This post looks at how to specify different CSS style rules for printing: using a secondary style sheet for print only, or defining the print styles in the main style sheet using @media print.

Multiple variable assignment with PHP

This post shows how it is possible to assign multiple variables with the same value with PHP. This can be useful if initializing multiple variables with the same initial value or if needing to make multiple copies of a value and then manipulate each separately.

Categories PHP

Using Apache mod_expires to control browser caching

Apache’s mod_expires module allows settings by file type to control how long browsers cache files. This is useful for ensuring browsers cache image, Javascript and/or CSS files without making additional unecessary requests when loading pages.