Sunday, February 1, 2015

<include --optional>

Bedrock 2.4.1-10 now includes a new option of the <include> tag.  The new --optional argument, will prevent Bedrock from throwing an exception if your include file is not found.  This might be useful for those situations where you might want to conditionally include a file.

<include:foo --optional>

There a couple of old school ways of achieving the same thing.

<if -e --file ($config.INCLUDE_DIR + '/foo.inc')>
  <include:foo>
</if>

or

<try>
  <include:foo>
<catch>
</try>

Either way you slice it, the old school way seems forced.  The --optional tag is admittedly syntactic sugar, but a welcome sweetener!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.