We will start by going through the various ways to find and retrieve content from eZ Publish using the API. While this will be covered in further, dedicated documentation, it is necessary to explain a few basic concepts of the Public API. In the following recipes, you will learn about the general principles of the API as they are introduced in individual recipes.
Table of Contents |
---|
Displaying values from a Content
In this recipe, we will see how to fetch a Content instance from the repository, and obtain its Field's content.
...
It is good practice to cover each exception you expect to happen. In this case, since our Command takes the content ID as a parameter, this ID may either not exist, or the referenced content may not be visible to our user. Both cases are covered with explicit error messages.
Browsing Locations
This recipe shows how to browse a subtree starting from a given location. (Full code here)
...
Info | ||
---|---|---|
| ||
Viewing Content Meta Data
This recipe shows how to read content meta data: Locations, UrlAliases, Relations, Versions, Contenttype, Section, Owner, RemoteId, Several Timestamps. (Full code here)
...
Code Block | ||
---|---|---|
| ||
Locations: Location: /1/2/103/ URLAlias: /testrootfolder Location: /1/2/94/106/ URLAlias: /Partner-Section/testrootfolder Relations: Relation of type EMBED to content Multivariate Testing Relation of type EMBED to content test Name: testrootfolder Type: folder Last modified: 2012-11-12 Published: 2012-11-06 RemoteId: 32d63a1493208f6d0e2d40ab25749af4 Main Language: eng-US Always avaialble: Yes Owner: Administrator User Section: Standard Version 1: 'Administrator User' ARCHIVED eng-US Version 2: 'Administrator User' PUBLISHED eng-US |
Performing a simple full text search
In this recipe a simple full text search is performed. (Full code here)
...
Info | ||
---|---|---|
| ||
Performing an advanced search
In this recipe different criteria is combined using a logic 'AND' operation. The result is restricted additional (see recipe 9) to a given content type and subtree. (Full code here)
...