开发者

dotCMS - how to find a contentlet by its field?

In dotCMS, I'm using $dot开发者_运维问答content.find('identified') to get a contentlet. What if I want to find a content by its custom fields (name, title, and date...)?


If you want to query a type of content by its fields, there is a little trick to find the correct syntax:

  1. Log into dotCMS (1.9 of newer) and click on the "Content" tab
  2. select the content you want to get the query for
  3. Fill in the values for the fields you want to query in the left part of the screen. If the fields your want to query by are not there, open the contents definition (in the structures tab) and make sure that you check the option "User Searchable" for field that you would like to query by.
  4. Now click the "Search" button and make sure you see the expected content in the result section of the screen.
  5. Now click on the little triangle next to the search button so it turns into a pull down menu and select "Show Query".
  6. In the popup you see the query that dotCMS uses itself to get the result content.

You can use that query yourself in your velocity code to get the content.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜