<?php
$priceTV = $modx->getTemplateVarOutput("price");
$price = number_format($priceTV['price']);
return $price;
?>[!Ditto? &tpl=`propertyList` &orderBy=`homeDate DESC`!]
<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>
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>
I tried that but it shows up as "0" instead of showing any numbers
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> ?
<?php //phx:fprice // print number in $output from placeholder with commas for thousands $fprice = number_format($output); return $fprice; ?>
<h4><a href="[+url+]">[+title+] <br />$[+price:fprice+]</a></h4>
it works! thanks alot!
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>