I wrote part of a template based system for some of my clients... I did it the simple way... several PHP files containing the layouts (with the correct content include points in them as I generally use the "include" content method with this type of thing), then store, in a database, the filename or number of the template you're using. And include that file... so your site would start with a database query then include the file stated in the database.
I don't know if that helps you... I'm not even positive I understand what you're asking.