Hi Folks (1st time poster here!) I am a .ASP website programmer (boo hiss) but am going to move into php, mainly for the cheaper webhosting and MySQL features. But I have a query. I currently use an .html template stored on my server and then I have a buildpage script which I call when I am creating standard pages, and just add it to my .asp pages. (default.asp etc etc) So they are created within the template, and thus all look the same, and everyone lives happily ever after. The buildpage script, replaces a line of text (XXXPAGECONTENTXXX) with the contents of the smaller .asp content page. I was wondering if one of you guys could help me out with a .php counterpart that I could replace my buildpage.asp with. (Obv the other pages will need tweaking to work, but this is the main milestone for me) Some help would be really appreciated! ( buildpage.asp below ) Cheers guys ------------- Buildpage.asp ------------------ [code] <% '------------------------------------------ 'CREATE PAGE SECTION STRINGS FROM TEMPLATE '------------------------------------------ Function ReadFromTemplate(strTemplateLocation, aryPageTemplate) '------------------------------------ 'LOOP THROUGH TEXT FILE CONTENT '------------------------------------ strTemplateLocation = "skin_default/template2.html" Set objFileSystem = CreateObject("Scripting.FileSystemObject") Set objFile = objFileSystem.GetFile(server.MapPath(strTemplateLocation)) Set objTextStream = objFile.OpenAsTextStream(1,0) strPageBaseText = objTextStream.ReadAll set objTextStream = nothing set objFile = nothing set objFileSystem = nothing '------------------------------------ 'FORMAT PAGE HEADER STRING '------------------------------------ 'Finally split the HTML into two pieces one for either side of the main page content aryPageTemplate = split(strPageBaseText,"xxxPAGECONTENTxxx",-1) ReadFromTemplate = aryPageTemplate End Function %> [/code] Then I simply put this at the top of my other pages [code] <%@ LANGUAGE="VBSCRIPT" %> <% '----------------------------------------------- 'NEED THIS INCLUDE FILE FOR EVERY PAGE '----------------------------------------------- %> <!--#include file="buildpage.asp"--> <% '----------------------------------------------- 'READ PAGE TEMPLATE FROM FILE '----------------------------------------------- Call ReadFromTemplate(strTemplateLocation, aryPageTemplate) '----------------------------------------------- 'WRITE FIRST HALF OF PAGE HTML '----------------------------------------------- response.write(aryPageTemplate(0)) %> *** PAGE GOES IN HERE *** *** THEN THIS BIT AT THE END OF THE PAGE *** <% '----------------------------------------------- 'WRITE LAST HALF OF PAGE HTML '----------------------------------------------- response.write(aryPageTemplate(1)) %> [/code]