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:
- Log into dotCMS (1.9 of newer) and click on the "Content" tab
- select the content you want to get the query for
- 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.
- Now click the "Search" button and make sure you see the expected content in the result section of the screen.
- Now click on the little triangle next to the search button so it turns into a pull down menu and select "Show Query".
- 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.
精彩评论