Well, There is no code that will work universally for EVERYTHING. There is always going to be a downside to something. The first solution i posted should work for major browsers like IE/Netscape/Mozilla. The second solution i posted is a little less multi-browser compatible *i think*, but im not sure, i use my suggested method
And no, your pages wont technicallyt load any slower, atleast not to a point where it is remotely noticable. The only way it might seem like the site loads slower is that the page hasnt been cached anywhere. But this is what you want, you want your dynamic pages to be dynamic, so this is the solution. You cant realisticly instruct your visitors to clear their cache to make sure they are viewing the latest version of your page, LOL