We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32645
    • 377 Posts
    I have a chunk called "chunk_sidebar", in which I want to put the content from the Abous Us page (2) (stripped of its HTML content) or its IntroText content in the sidebar.

    I am not sure how to do this.

    I tried using Ditto, but it looks at children, and not the actual article itself.

    How do I output the content from any page into sidebar, or other chunks?

    ie:
    [[getIntroText? &id=`2`]]
    
      • 36926
      • 701 Posts
      Try the GetField Snippet
        • 3749
        • 24,544 Posts
        A template variable with the @DOCUMENT binding will get just the content field.

        If you need to strip the HTML tags in the content (not sure why you’d want to), I think you can use the TV as a parameter in a snippet call and just use strip_tags() in the snippet.
          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
          • 32645
          • 377 Posts
          Hi there.

          Thanks for the solutions provided. I made my own snippet to resolve the problem, and it worked fine.

          <?php
          /**
          * getDocument
          */
          
          if (!isset($field)):
          	$field = 'introtext';
          endif;
          
          $doc = $modx->getDocument( $id, '*', 1);
          
          foreach($doc as $doc_field=>$doc_value):
          	if ($doc_field == $field):
          		//(print $doc_field .' --> '. $doc_value . '<br />';)
          		return ($doc_value);
          	endif;
          endforeach;
          ?>