Display Structure Information in a Content Pull - Documentation topics on: content,dynamic content,structure,.

This documentation is a static copy for this version. For current documentation, see: http://dotcms.com/docs/latest

Display Structure Information in a Content Pull

While using the content tool, you can pull the name and description fields of the Content Type while pulling the contentlet dynamically on a page. Consider the following simple velocity content pull which retrieves and displays a list of employee names:

#foreach($employee in $dotcontent.pull("+contentType:Employee +(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797 conhost:SYSTEM_HOST)",5,"Employee.lastName"))
    <p>
        $velocityCount. $employee.lastName, $employee.firstName
    </p>
#end

If desired, more properties of the Content Type can also be displayed, in addition to the content being pulled.

In the following code the properties of the Content Type itself in velocity are displayed (using the method [content item variable].contentType.[content type property]), before displaying the list of employees:

#foreach($employee in $dotcontent.pull("+contentType:Employee +(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797 conhost:SYSTEM_HOST)",5,"Employee.lastName"))
    <h2>Content Type: $employee.contentType.name</h2>
    #if($velocityCount == 1)
        <ul>
            <li>Description: $employee.contentType.description</li>
            <li>Velocity Variable: $employee.contentType.velocityVarName</li>
            <li>Detail Page: $employee.contentType.pagedetail</li>
            <li>URL Map Pattern: $employee.contentType.urlMapPattern</li>
            <li>Base Type: $employee.contentType.baseType<br />
                <i>(Content=1; Widget=2; Form=3; File=4)</i></li>
            <li>Host : $employee.contentType.host</li>
            <li>Folder: $employee.contentType.folder</li>
            <li>Publish Date Variable: $employee.contentType.publishDateVar</li>
            <li>Expire Date Variable: $employee.contentType.expireDateVar</li>
            <li>Content Type Inode: $employee.contentType.inode</li>
        </ul>
    #end
    $velocityCount. $employee.lastName, $employee.firstName
#end