--- title: Features blurb: Features work similarly to targets, but give you much more fine-grained control. layout: template-logo-medium --- <%= md_links %> <%= md_images %> <%= current_page.data.title %> ============================== <%= current_page.data.blurb %> Demonstrations --------------- * * * <% if target_feature?(:feature_advertise_pro) %> **New! Today Only!!! Act before this special offer is gone forever!** Why settle for the limitations of _Middlemac Free_ when you can upgrade to _Middlemac Pro_ for this limited time, special price of only $1299.99? (Note: there is no _Middlemac Pro_. This is part of the Features demonstration.) * * * <% end %> <% if target_feature?(:feature_performs_miracles) %> If you open your water faucet, clean, safe, potable water will flow out of it. _Middlemac_ has made this miracle happen for you. * * * <% end %> <% if target_feature?(:feature_insults_user) %> If you have made it this far, dear reader, you should know that if brains were dynamite, you wouldn’t have enough to blow your nose. <% else %> If you have made it this far, dear reader, you should know that you are one of the best people in the world. <% end %> * * * <% if target_feature?(:feature_shows_pink_rectangle) %> I made a special, pink rectangle just for you! <% else %> Too bad; other people got to see a nice, pink rectangle. <% end %> * * * Recall our targets’ `feature` settings -------------------------------------- Our `:free` target uses these `feature` settings: ~~~ ruby :feature_advertise_pro => true, :feature_performs_miracles => false, :feature_insults_user => true, :feature_shows_pink_rectangle => true, ~~~ And `:pro` was setup with these `feature` settings: ~~~ ruby :feature_advertise_pro => false, :feature_performs_miracles => true, :feature_insults_user => false, :feature_shows_pink_rectangle => true, ~~~ Depending on the target that you are currently viewing, you should very easily be able to correlate what appears in the **Demonstrations** section with the `feature`s settings above. Try changing some of the values and see what happens to this page. Targets vs Features ------------------- While you can use targets exclusively, it’s then up to you to decide which content you want to include in each of your help books when your Mac OS X applications have different features. For example, what happens when you decide to enable or disable a feature in a future release of your application? If you use targets alone, you’ll have to go back and make a lot of changes to your help content. If you use **features**, instead, it’s as simple as toggling the value of your target’s `:features` sub-key between `true` and `false`. How did this work? ------------------ Features work nearly identically to [targets][targets]. Instead of using the `target_name?` helper, use the `target_feature?` helper instead. For example: ~~~ erb <%% if target_feature?(:feature_insults_user) %> If you have made it this far, dear reader, you should know that if brains were dynamite, you wouldn’t have enough to blow your nose. <%% else %> If you have made it this far, dear reader, you should know that you are one of the best people in the world. <%% end %> ~~~ Include or exclude entire pages ------------------------------- Just as with targets, you can use front matter `target` and `exclude` to include or exclude entire pages.