Home > Item #6
I want to use include files in skin templates. I have inserted them but I just get the include code appear in the HTML of the page. How can I use includes in my template?
You cannot use includes in the skin template because the skin template is read verbatim by CactuShop to create the HTML for a page. The skin, or include files within it are not run, purely read, hence you do not see the HTML the include would produce if you ran it. You simply see the text of the reference to the include file.
The way around this is to create a new custom tag, similar to the ones we use for the basket summary and category list.
1. To create a custom tag, add the new tag to the HTML skin template... add the text xxxMYTAGxxx where you wish your tag to appear.
2. This tag text will be replaced with the contents of your include. You need to code your include so that it builds a string of text and stores this as a variable rather than writes HTML direct to the screen. Insert this include into your buildpage.asp file.
3. Add a line near the bottom of buildpage.asp to swap the tag for your text string...
i.e. in v6:
strPageBaseText = Replace(strPageBaseText, "xxxMYTAGxxx", strMyText)
PageBaseText = Replace(PageBaseText,"xxxMYTAGxxx",strMyText)