Jump to content

whiteknight

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

whiteknight's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. No specific examples sorry. But try hunting about university sites that release public stuff like that.
  2. [quote author=gerkintrigg link=topic=104735.msg417943#msg417943 date=1155907195] um.. I might be wrong, but if you're trying to create hard static pages (IE export to a folder as an HTML file), you are probably not going to get a good answer out of me. (sorry). But if you're doing it all at runtime, you could just split the page in half (coz you're kinda doing that in script anyway) and include / require each bit... So: <?php // $root is the path to the root directory for this folder and keeps all links relative. $root='../'; include $root.'top.php';?> My text stuff goes here... possibly imported from a $variable <?php echo '$root.'bottom.php';?> [/quote] Hmm I think I know where you are going. Yeah I'm doing it all at runtime, the template is stored in a folder, and then the middle section of all the pages are created seperatly, so when I upload and link to say page1.asp (it is only the middle section) it has the build page script at the top and the browsers generate the full page without me having to create them each time.,  the site is www.cmdclan.co.uk if ur interested.
  3. 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]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.