We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24495
    • 407 Posts
    Preview of an unpublished document (in backend) shows only the content but not content of TVs generated by snippets. Why?
    Is it possible to change the preview to see the document like defined in assigned template?

    Example of template code:
    ...
    <body>
    [[snippet_showing_TV's_content_of same_document]]
    [*content*]
    </body>
    </html>
    
      • 3749
      • 24,544 Posts
      If the document is published, do you see those things in the front end?
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 24495
        • 407 Posts
        If the document is published, do you see those things in the front end?
        Yes, of course.

        In backend and if doc is unpublished TVs are shown if I call them directly via
        [*nameOfTV*]


        This is a short snippet to put a text area if text is available:
        <?php
        $id= (isset($id))? $id : $modx->documentIdentifier;
        $tvrt = $modx->getTemplateVar('reiseText',"*",$id);
        $tvrth = $modx->getTemplateVar('reiseTextHead',"*",$id);
        
        if ($tvrt['value'] != '') {
        $output ='<div class="infoblock">';
        if ($tvrth['value'] != '') { $output .= '<h2>'.$tvrth['value'].'</h2>'; } else { $output .= '<h2>[*pagetitle*]</h2>'; }
        $output .= $tvrt['value'].'</div>';
        return $output;
        }
        ?>

        This isn’t visible in preview if document is unpublished.