on 12-10-2004 3:33 PM
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 <i><%@ include file="pagefragment.htm"%></i> 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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.