Skip to Content
author's profile photo Former Member
Former Member

Including page fragments

I have lots of page fragments and I want to include only one of them on bsp based on a value of a variable.

How can I do this?

I wrote <%@ include file="pagefragment.htm"%> into a string and then put that string on the layout, but surprise, surprise, it doesn't work.

Can I somehow use

<%@ include file="pagefragment.htm"%>

and define the relative URL dynamically?

Any other ways to include a page fragment?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 10, 2004 at 03:52 PM

    I don't know how dynamic you need it to be but you could always do a if check or case statement like the following:

     <%
      if content->design2002 is not initial.
            %>
            <%@include file="script2002.htm" %>
            <%
      else.
            %>
            <%@include file="script2003.htm" %>
            <%
      endif.
            %>
    

    Not its going to seem like I am really harping on the whole MVC thing this week, but if your situation is really that complex you are probably better off using MVC. You could call a generic controller with would then decide what View to include. View also have the advantage that they don't expand in place at runtime. They have their own class (and therefore avoid generation limits). You can also debug inside of an included view (unlike page fragments). You can also dynamically provide values to the BSP:call URL parameter.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.