PHP:

````php
<!-- check if document is published, regardless of current users role -->
<?php if ($view['cmf']->isPublished($page)) : ?>
    <!-- ... output the document -->
<?php endif ?>

<!--
    check if current logged in user is allowed to view the document either  
    because it is published or because the current user may view unpublished  
    documents.  
-->
<?php if ($view['security']->isGranted('VIEW', $page)) : ?>
    <!-- ... output the document -->
<?php endif ?>  
````