On Oct 27, 12:11 pm, Matt Jones <[email protected]> wrote: > On Oct 27, 2009, at 2:55 PM, beachbc wrote: > > > Thanks again Matt! > > > So parallel to ruby; > > <do param="default" /> - allows a user to pass in sort of hobo > > "block?" > > The key thing with param="default" (as opposed to > param="anything_else") is that param="default" doesn't require that it > be named explicitly. For instance, defining tags like this: > > <def tag="something"> > <div param="anything-else" /> > </def> > > <def tag="something-with-default"> > <div param="default" /> > </def> > > You'd call the first one like: > <something> > <anything-else:> > Foo! > </anything-else:> > </something> > (note the :s on the anything-else tags) > > And the second like: > <something-with-default> > Foo! > </something-with-default> > > So param="default" allows for tags that look more like a regular piece > of HTML. Note that you can't (AFAIK) mix the two styles in one tag. > There's also some neat tricks with accessing parameters.default > directly, which allows you to stick the default parameter in places > where you typically couldn't put a DRYML param tag. For instance: > > <def tag="img-nav-item" attrs="name"> > <% content = parameters.default %> > <% current_class = 'current' if scope.current_navigation == name %> > <a merge-attrs="href, action, to, class"><img src="/images/ > invis.gif" style="background-image:url(/images/nav_items/#{name}.png)" > alt="#{content}" class="#{current_class}" /></a> > </def> > > This is from the same project as the first example, when we were > considering a sprite-based image navigation (the background offsets on > hover). An actual usago of img-nav-item would look like: > > <img-nav-item name="schedule" href="...">Schedule</img-nav-item> > > The "content" of the tag here actually turns into the img tag's alt > attribute. > > You may also want to check out the rest of the DRYML manual on the > cookbook site; there's lots of useful things that may surprise you. > For instance, the merge-attrs in img-nav-item means that I can > basically treat it like a regular <a> tag, passing it to=, action=, etc. > > --Matt Jones > > > Therefore, if I were to extend your "main-nav" tag, I could add my own > > <do param="default" />, and have it work as expected? > > > Also, as general rule; it gets placed in a tag definition and not in a > > tags implementation? > > > One last question, it is perfectly valid to not not include anything > > in between tags? (don't supply anything to the <do param="default" />)
Awesome! Thank you very much for your time! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
