简体   繁体   English

LiftWeb中带有参数的菜单的代码片段的名称和位置?

[英]Name and location of snippet for Menu with param in LiftWeb?

Sorry if this sounds stupid but I'm really new to LiftWeb and just struggling with the basic stuff:) 抱歉,这听起来很愚蠢,但我对LiftWeb真的很陌生,只是在尝试一些基本工作:)

So I have a parametrized site map entry in Lift's bootstrap. 因此,我在Lift的引导程序中有一个参数化的站点地图条目。 This should be for the view page of an object of type MyItem. 这应该用于MyItem类型的对象的视图页面。 The URL would be like: "/myitems/UUID". 该URL类似于:“ / myitems / UUID”。

Menu.param [UUID]("MyItemView", "MyItemView", p=>Full(UUID.fromString(p)), p=>p.toString) / "myitems"

This adds the sitemap entry correctly. 这样可以正确添加站点地图条目。 If I go to "/myitems/NOT_AN_UUID", it will throw the "Invalid UUID" exception as expected. 如果我转到“ / myitems / NOT_AN_UUID”,它将按预期方式抛出“ Invalid UUID”异常。 But if I go to "/myitems/UUID" I get 404. 但是,如果我转到“ / myitems / UUID”,则会得到404。

I know that I need a view and a snippet class that takes UUID as parameter in order for this to work but I have no idea how to name these and where to place them . 我知道我需要一个视图和一个以UUID作为参数的代码片段类才能使其正常工作,但是我不知道如何命名它们以及将它们放置在何处

Btw, how would one new to Lift learn something like this? 顺便说一句,Lift的新手将如何学习这样的东西? From the hundreds of articles and samples out there I found many to mention more complex stuff but haven't seen any to mention a basic thing like this. 从数百篇文章和示例中,我发现有很多人提到更复杂的东西,但没有人提到这样的基本东西。 Do you know any secret start-up documentation for human beings ? 您是否知道任何有关人类的秘密启动文件

Update: To summarize in case all you see above is jibber-jabber :) HOW DOES LIFT LOCATE TEMPLATES/VIEWS/SNIPPETS FOR PARAMETRIZED MENU ENTRIES? 更新:总结一下,以防万一您在上面看到的只是jibber-jabber :) 如何提升参数化菜单项的模板/视图/片段的位置?

It was actually the obvious answer. 实际上,这是显而易见的答案。 The template name is obtained from the path and the snippet can be whatever you want as long as you call it from the template xml. 模板名称是从路径中获得的,并且该片段可以是您想要的任何内容,只要您从模板xml调用它即可。

I need to get used to all this convention over configuration :) However it would be nice for someone to tell you what is the convention. 我需要习惯于配置上的所有这些约定:)但是,最好有人告诉您什么是约定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM