This is a noob question... I am trying to understand how site definitions, templates, etc. all work together when a SharePoint page is requested. I understand that site definitions are "base templates" while site templates capture the "delta" between site definitions and applied customizations.
When a page request is received by SharePoint, how does SharePoint know which base site definition to use? I looked at the Web table (in the content DB) and see a WebTemplate column. I was able to map that back to the templates defined in WebTemplate XML files located at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\WebTemp*.xml. Does each Template in these files correspond to a folder under ....\SiteTemplates\?
With customization, use of custom site templates (STP files) and pages getting unghosted (or customized), I have heard that the pages or templates themselves are stored in the database as opposed to using those on the WFE server.
I could not find any one explanation or article that paints the whole picture!