We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3689
    • 264 Posts
    I have a page showing all the different prices for homes. Its pulling the Home name fine, but it’s not displaying the commas like it is on the child pages for some reason so $1,000 becomes $1000. I have a snippet that formats the pricing named [[price]] but it wont display correctly.

    [[price]]
    <?php
    $priceTV = $modx->getTemplateVarOutput("price");
    $price = number_format($priceTV['price']);
    return $price;
    ?>


    Heres the Ditto Call on the Summary Page:
    [!Ditto? &tpl=`propertyList` &orderBy=`homeDate DESC`!]


    Here is propertyList:
    <div class="propertycontainer span-4">
    <div class="propertyimg clear">
    [[MaxiGallery? &gal_query_ids=`[+id+]`&limit=`1` &galleryOuterTpl=`galOutter` &galleryPictureTpl=`galleryPicListings`]]
    </div>
    <div class="propertytitle">
    <h4><a href="[+url+]">[+title+] <br />$[+price+]</a></h4>
    </div>
    </div>
      • 11055 ☆ A M B ☆
      • 3,112 Posts
      Quote from: BnH at Jan 11, 2010, 12:26 AM

      Here is propertyList:
      <div class="propertycontainer span-4">
      <div class="propertyimg clear">
      [[MaxiGallery? &gal_query_ids=`[+id+]`&limit=`1` &galleryOuterTpl=`galOutter` &galleryPictureTpl=`galleryPicListings`]]
      </div>
      <div class="propertytitle">
      <h4><a href="[+url+]">[+title+] <br />$[+price+]</a></h4>
      </div>
      </div>


      <h4><a href="[+url+]">[+title+]
      $[[price]]</a></h4> ?
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
        • 3689
        • 264 Posts
        Quote from: goldsky at Jan 11, 2010, 02:58 AM

        Quote from: BnH at Jan 11, 2010, 12:26 AM

        Here is propertyList:
        <div class="propertycontainer span-4">
        <div class="propertyimg clear">
        [[MaxiGallery? &gal_query_ids=`[+id+]`&limit=`1` &galleryOuterTpl=`galOutter` &galleryPictureTpl=`galleryPicListings`]]
        </div>
        <div class="propertytitle">
        <h4><a href="[+url+]">[+title+] <br />$[+price+]</a></h4>
        </div>
        </div>


        <h4><a href="[+url+]">[+title+]
        $[[price]]</a></h4> ?
        I tried that but it shows up as "0" instead of showing any numbers
          • 16278
          • 928 Posts
          Maybe the the TV isn’t being evaluated before the snippet call?

          You can use a PHx modifier to process the output of the placeholder. Make a snippet called phx:fprice
          <?php
          //phx:fprice
          // print number in $output from placeholder with commas for thousands
          
          $fprice = number_format($output);
          return $fprice;
          ?>

          and feed the output of [+price+] into it in the template:
          <h4><a href="[+url+]">[+title+] <br />$[+price:fprice+]</a></h4>
            • 3689
            • 264 Posts
            Quote from: kp52 at Jan 11, 2010, 04:31 AM

            Maybe the the TV isn’t being evaluated before the snippet call?

            You can use a PHx modifier to process the output of the placeholder. Make a snippet called phx:fprice
            <?php
            //phx:fprice
            // print number in $output from placeholder with commas for thousands
            
            $fprice = number_format($output);
            return $fprice;
            ?>

            and feed the output of [+price+] into it in the template:
            <h4><a href="[+url+]">[+title+] <br />$[+price:fprice+]</a></h4>

            it works! thanks alot!