1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Image count on showlisting.tpl

Discussion in 'Templates, HTML, CSS, and Design Help' started by jason1971, Mar 31, 2014.

  1. jason1971 Customer

    Hi all,

    Any thoughts on how to count the number of images / photos each advert has, to then be shown in showlistings.tpl

    EG: This advert as 10 photos

    any help REALLY appreciated

    Thank Jason.
  2. Mike-N-Tosh Owner

    You would just need to query the DB table for the count of rows for the listing id in a plugin. I could see how this would be very handy, so I went ahead and made the plugin!

    The plugin, simply returns the integer number of pics (including 0). Use it like any other plugin and use $entry.id for the lid like this in your showlistings(2).tpl file and any text that you want to display before and after the plugin call:

    Example might be used after the actual thumbnail pic on a new line
    <div style="width:100%;text-align:center;font-weight:bold;">
    {total_pics lid=$entry.id} pics
    </div>

    Attached Files:

  3. Mike-N-Tosh Owner

    Did this work the way you wanted it to, Jason?
  4. jason1971 Customer

    Mike what can I say, thanks for going that extra mile for me, and I hope other people can use this as well.

    Mike your a star, thank you very much.;)
  5. freeze2 Super Moderator

    Great plugin Mike...my brain is thinking about some new wild and crazy ways to implement it :)
    Mike-N-Tosh likes this.
  6. Mike-N-Tosh Owner

    Uh oh, Freeze! I can see it now...
    Code:
    {total_pics lid=$entry.id assign="pics"}
    {if $pics==0}
      <strong>{$owner} is so LAME<br />
      He didn't upload any pics!!!</strong>
    {else}
      <br />There are $pics pics.
    {/if}
    :p:D
  7. freeze2 Super Moderator

Share This Page