Couple of coding requests

Discussion in 'Customizations' started by BlackWebs, Aug 13, 2013.

  1. BlackWebs New Member

    Hi all,

    Just wondering if anyone can help me with finishing off some modifications I've been working on today - please see below, any pointers you can provide would be great;

    1) I've added a featured Carousel on the home page, but can't figure out how to truncate the description text. I'm using function.feature_listings_horizontal.php and added in the description bit with;

    $output.= $loop[$x][description];

    I was hoping to add some sort of Smarty truncation method onto it but nothing seems to work.

    2) I would also like to get prices that a £0 to be POA in the featured Carousel, but again the things I've tried don't seem to work. The last car in the rotation is £0 (Ferrari F12).

    This also happens on the Favourites/My Shortlist - but everywhere else is fine and changes to POA as needed.

    Thanks a lot,
    Tom
  2. Mike-N-Tosh Owner

    The code you are showing is php and I assume is in the plugin itself. Smarty only works in the template. What version of the classifieds are you using? If you are using v4.2.4, I personally would use the listings plugin instead which is assigned to the template. That way as you place the individual variables from the array within your template however you would like. This would then include the ability to use the smarty truncate function: {$loop.x.description|truncate:xx:"..."}.

    I hope that you are modifying a copy of the plugin, or you are going to have trouble when you want to update/upgrade in the future. If you insist on doing it in the plugin, itself, then you need to use php to truncate the description. I would recommend using substr.
  3. BlackWebs New Member

    Thanks Mike - hadn't considered that, all working now. I initially tried with the listings plugin but wasn't getting anywhere, so I made a copy of the original function which worked straight away.

Share This Page