We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 791
    • 46 Posts
    I have an estate agency site that displays properties in a summary listing and in full detail using Ditto calls. I have successfully created a simple PHX modifier to format the price into groups of 000’s (with a , in between) by creating a new snippet called phx:price_format and containing the code
    <?php
    $niceprice = number_format($output);
    return $niceprice;
    ?>

    A chunk is called by Ditto to format the summary listing output which contains the placeholder [+saleprice:price_format+], and that works perfectly.

    Now I want to also format the price on the main property detail page, which is based on a template with various TV calls (including the TV ’saleprice’). According to the PHX documentation I should be able to use the modifier in a TV call like [*saleprice:price_format*]... But this doesn’t work.

    Can anybody help?
      Learning a little more each day.
      • 4310
      • 2,310 Posts
      You could just use a snippet along these lines :
      <?php
      $tv = $modx->getTemplateVarOutput(true, $modx->documentIdentifier);
      $output = $tv['saleprice'];
      $niceprice = number_format($output);
      return $niceprice;
      ?>
      

      Use it in the template instead of the TV
        • 791
        • 46 Posts
        Woohoo! bunk58, you’re the man. Thanks SO much. That works perfectly.

        I promise to learn PHP in 2011.
          Learning a little more each day.