Calm down! Calm down. It's okay. There's no danger here. Unlike the terrifying toe eating widgets of the Gobi dessert, Subway's variety are friendly. They're small, cuddly and unicorn-like in their ability to slowly drain impure thoughts from your brains.
Subway's widgets are small bits of view code available in the widget namespace. This means that your views can include those widgets whenever they are needed. The widgets themselves live in your application's widget directory and are, just like Subway's views, Cheetah templates. Here's an example widget that I'm fond of:
#if 'notice' in $flash
<div class="notice">
$escape($flash.notice)
</div>
#end if
That's Subway's notice.html widget which is used for web status notification. Whenever you need it, just drop it into your view using
$widget.noticeand you're all set. If you need to you can also pass arguments to your widgets using normal Python syntax.
My friend, if you like widgets, and I mean really like widgets, then go read Subway's How-to page on them right now!
No comments:
Post a Comment