PDA

View Full Version : compiler directive


monkeytroy
10-22-2007, 12:14 PM
I was playing with compile-time constants.

According to the doc I should be able to do this:


if ($slow) { ... slow way ... } else { ... fast way ... }


and then compile with -Dslow=false if I want the slow code to execute.

Two questions..

Can you pass the slow constant in when running to app in server mode via the command line? When I run it in the server it fails with an error saying that slow doesnt exist.

Also.. say I want to compile two versions of my app with two different views in them..

How can I do that?


if ($verOne) {
<view name="one"/>
</view>
} else {
<view name="two"/>
</view>
}


Fails because the if statement is outside of elements.

Can this be done?

notzippy
10-23-2007, 08:53 AM
Try _root['slow']