Knowledgebase

Home > Item #6

I want to use include files in my skins but it doesn't work / Creating custom buildpage tags

Item: #6
Date: 26 Jul 2001
Applies to
v3
v4
v5
v6

Question

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?

Answer

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)

or in previous versions of CactuShop:
PageBaseText = Replace(PageBaseText,"xxxMYTAGxxx",strMyText)

If you've coded it right, you should have your include building up a string of text which is then substituted with the custom tag when the page is run.

Can't find the answer you need? Click here to open a support ticket.

« Back