tiro <tim.romb...@googlemail.com> writes: > Jeppe> We've made primary/secondary navigation where primary > navigation is ... > > I did something similar..found it difficult to work with the default > snippets. > But found it hard, when writing my own group snippet, to identify the > current Loc within the LocGroups Locs.
It's been a while since I wrote this, so don't recall if there any issues, but this is my group snippet: def group(template:NodeSeq) : NodeSeq = { val toBind = if ((template \ "bind").filter(_.prefix == "menu").isEmpty) <xml:group><menu:bind/> </xml:group> else template val attrs = S.prefixedAttrsToMetaData("a") for (group <- S.attr("group").toList; siteMap <- LiftRules.siteMap.toList; loc <- siteMap.locForGroup(group); req <- S.request; curLoc <- req.location; link <- loc.createDefaultLink; linkText <- loc.linkText) yield { val a = (if (inPath(loc, curLoc.breadCrumbs)) <span>{linkText}</span> else <a href={link}>{linkText}</a>) % attrs Group(bind("menu", toBind, "bind" -> a)) } } > > So Jeppe, would be very interested in your code for that snippet. Mine > is below (only slightly modified from Menu.group). But it's not yet > quite there. I also used Menu.group as a starting point..... > > I also had a fiendish problem (lift 1.0.2 scala 2.7.5) when trying to > use attributes li:class="x" li_item:class="y" on the tag. Isn't that a > standard technique? Does it work for everyone else? For me, Scala > chokes on that with a syntax error (further experiments suggest that > it doesn't like two attributes with same name and different prefix, > perhaps also because BOTH prefixes are from an unknown namespace). Of > course it doesn't show you the exact error but faults with an > IllegalArgumentException on scala.io.Source, but this has been > discussed elsewhere. Anyway, that's why I have the new unprefixed > attributes in the code below. > Actually, I think I reported this as well and this works now (at least in 1.1-SNAPSHOT). If possible, you should upgrade to 1.1 since the error reporting has improved a lot. The IllegalArgumentException error you see is not the root cause in your code, but an error that happens when trying to show the source of the error ! /Jeppe --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---