Nesting Variables with Gantry Conf

By Tim Keefer
Apr 5 2007 7:44 p.m.

I've recently made a change to Gantry::Conf which allows for the nesting of configuration variables. In this example I have defined a sample_instance where I want to pull in the correct site wrapping depending on uri location. However, I don't want to specify a wrapping for each location, because I'm lazy. I just want to specify the lowest, most common location and set the wrapping there. This is where the nesting helps out.

<instance sample_instance>

     dbconn dbi:SQLite:dbname=app.db
     template_wrapper customer_wrapper.tt
     doc_rootp /static

    <GantryLocation /admin>
        template_wrapper admin_wrapper.tt
    </GantryLevel>

    <GantryLocation /admin/user>
        template_wrapper user_wrapper.tt
    </GantryLevel>

</instance>
so considering the conf instance above, the following urls map to these templates
   /     (customer_wrapper.tt)
   /admin      (admin_wrapper.tt)
   /admin/user    (user_wrapper.tt)
   /admin/some/other/location  (admin_wrapper.tt)
   /stats   (customer_wrapper.tt)
Post a comment

use the force, Luke