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

Thumbnail in userbrowse listings

Discussion in 'Technical Support' started by bowers01, Mar 9, 2015.

  1. bowers01 Genius At Work

    Hi,
    I am wanting to display a thumbnail in the userbrowelisting.tpl page but using {debug} the pictures are not made available.
    How would I go about doing that? It is a bit of a pain going though the listings once you have a few.
    Cheers,
    Nick
  2. freeze2 Super Moderator

    Found this in my archives...hopefully it will work :)


    *************************************************

    Add thumbnail to userbrowselistings.tpl

    *************************************************

    includes/classes/kernel/Listings.php

    Line: 682

    Find:

    $row['expirationTime'] = strtotime($row['expiration']);

    Just below this line, add:

    $row['image']=$this->getListingSingleImage($row['id']);



    Approx Line: 654

    Find:

    $sSQL = "SELECT id,title,section,price,display,hitcount,dateadded,expiration,orderID,oType,oStatus,oProductID,"

    Add featured as below:

    $sSQL = "SELECT featured,id,title,section,price,display,hitcount,dateadded,expiration,orderID,oType,oStatus,oProductID,"

    (as of 4.2.4 use l.featured,l.pBold,l.pHighlighted etc...)


    *************************************************

    And then something like this in your template file:

    <a href="viewlisting.php?view={$entry.id}">
    {if $entry.image != ""}
    <img src="thumbs/small_{$entry.image}">
    {else}
    <img src="path-to/nophotosmall.gif">
    {/if}
    </a>
  3. Mike-N-Tosh Owner

    You don't need the part that refers to the "$sSQL =..." that is something completely different and is not needed to get your images.

    You only need to add the line:
    $row['image']=$this->getListingSingleImage($row['id']); <-- This does it's own query to get your image and adds it to the listings array

    Then add the code in your template file where you want the image displayed.
  4. bowers01 Genius At Work

    Excellent, thanks that worked perfect.
    Cheers

Share This Page