We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13137
    • 204 Posts
    I am slooooly starting to understand how MM works now.

    With the kind help of TobyL I was able to get the summary replaced with a TV and rule from MM.

    Create a new TV,
    Variable Name: mySummary,
    Caption: Summary
    Input Type: RichText
    Leave the rest empty.
    Assign it to the templates you want to use it in.

    With new rules applied:
    mm_hideFields('introtext');
    mm_moveFieldsToTab('tvmySummary', 'general');


    And replace [+intro_text+] with [+mySummary+] in templates.

    My question is, would it be possible to add some kind of rule that if the new mySummary field were blank that it would use the intro_text instead?
    Basically I would like to have rich text in the inro, but if none is entered in a news/blog, that it would display a summary instead.

    I don’t know if I’m making myself understood or not?
      • 30223
      • 1,010 Posts
      Shame you posted this in a new thread. It would have been better to  continue in  http://modxcms.com/forums/index.php/topic,25991.msg199686.html#msg199686. This just scatters the information.

      Do you want this so you don’t have to move existing introtext over to the new TV?
      It would be better to bite the bullet and just edit the pages concerned by copying and pasting. Otherwise, since you are now hiding the introtext from the editor you’ll be creating orphaned data that might bite you later if you ever decided to start using the introtext field again.

      Having said that if you really insist you could write a little snippet which checks the TV for the current document and fetches the value from the appropriate field accordingly. In the document you then replace [*introtext*] with [[snippetName]] instead of [*mySummary*]

      in pseudo code it would be something like this:
      $output = getTemplateVarOutput('mySummary');
      if(! $output ) $output='[*introtext*]';
      return $output;
      

      There’s slightly more involved but reading up on the modx api functions in the wiki should help you along.