We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2901
    • 277 Posts
    Hi all
    I try to replace a title via a phx with another languages title. I’ve created a TV as tag and use the tag as title inside the template. My PHx looks like this
    [+phx:if=`<h3>[+preis+]</h3>`:is=`<h3>agroPreis</h3>`:then=`<h3><em>agroPrix</em></h3>`:else=´[+phx:if=`<h3>[+preis+]</h3>`:is=`<h3>Saalpreis und Leserpreis</h3>`:then=`<h3>Prix de la salle et des lecteurs</h3>`+]´:else=´[+phx:if=`<h3>[+preis+]</h3>`:is=`<h3>Spezialpreis SLV/ASMA</h3>`:then=`<h3>Prix spécial SLV/ASMA</h3>`+]´:else=´[+phx:if=`<h3>[+preis+]</h3>`:is=`<h3>Saalpreis</h3>`:then=`<h3>Prix de la salle</h3>`+]´:else=´[+phx:if=`<h3>[+preis+]</h3>`:is=`<h3>Leserpreis</h3>`:then=`<h3>Prix des lecteurs</h3>`+]´+]


    Anyone any idea!

    Thanks in advance
    • Perhaps a snippet would be a better solution in this case.
      <?php
      $TV = $modx->getPlaceholder('preis');
      switch ($TV) {
          case 'agroPreis':
              return '<h3><em>agroPrix</em></h3>';
              break;
          case 'Saalpreis und Leserpreis':
              return '<h3>Prix de la salle et des lecteurs</h3>';
              break;
          case 'Spezialpreis SLV/ASMA' :
              return '<h3>Prix spécial SLV/ASMA</h3>';
              break;
          case 'Saalpreis' :
              return '<h3>Prix de la salle</h3>';
              break;
          case 'Leserpreis' :
              return '<h3>Leserpreis</h3>';
              break;
      }
      return;
      

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 2901
        • 277 Posts
        Hi Susan

        I’ve tried the snippet in my Ditto call, but there is no title replaced at all, actually the content from ’preis’ is not showing at all.. Following you see my ditto call, maybe there is a problem with that, but I doubt it. My TV is a Checkbox - I guess this should work.
        $tpl = '@CODE:
        <div class="contest group">
        [[winnerFr]]
        <div class="imgContest">[+teilnehmer+]</div>
        <div class="contContest"><h3>[+title+]</h3>
        [+phx:if=`<p>[+longtitle+]</p>`:is=`<p></p>`:then=``:else=`<p><strong>[+longtitle+]</strong></p>`+]
        [+content+]</div>
        </div>';


        winnerFr is the name of the snippet. I’ve also tried to call the snippet uncached, but no look either.

        thanks

          • 20413
          • 2,877 Posts
          Do you still have html "<h3>" in the tv values?

          If you want to use html there then try pre-set it:
          <h3>agroPreis</h3>==1||<h3><em>agroPrix</em></h3>==2

          So you can do things with 1 and 2 instead...
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower