On Sep 11, 2005, at 5:59 PM, Rick Hazey wrote:

If I create a page with this content:

<%

if(true)
 include("page1.html")

else
 include("page2.html")

end if

%>

and view with a web browser, it contains the same content as calling page1.html directly.

This is the behavior I want but it is not the behavior I expected. I expected the browser to be sent page1 and page2 concatenated together.

Why? The "else" clause should not (and correctly was not)  executed.

If you had done:
<% include("page1.html")
include("page2.html") %>
then you would have gotten a concatenation of both pages.

It is not at all uncommon to use multiple includes on one page.

<% include("security.a4d) %>
<% include("header.html") %>
<% include("navigation.a4d") %>
<!-- page specific content below -->
<p class="example">Hello World</p>
<% include("footer.html") %>

Am I using include properly? Can I rely on this behavior?

You are using includes properly, but your question makes me wonder about your understanding of "if...else...end if".
(Yes, that sounded way more harsh than intended.)

Just as in 4D itself, if the if() portion is true, the else portion is not executed. So I don't understand why you expected to see page2 included.

--
Bart Alcorn          AvantraNet, Inc.
Office:   678-580-3265
Mobile: 770-335-5518
AIM/iChat: AvantraNet

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to