Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Help with IF ELSE Statement

  1. #1
    Join Date
    Jun 2004
    Location
    Lakeland Florida
    Age
    47
    Posts
    74

    Default Help with IF ELSE Statement

    I am trying to use the following script on the search results and listing detail pages and I am sure it isnt 100% correct, because it doesnt work. I am not even sure if I can use php script in the search results and listing detail pages. Can anyone give me a little direction, this is what I am trying to do.

    <?php
    if ({listing_field_PHOTO_QUANTITY_value} > 0) {
    echo "<a href="{fulllink_to_listing}"><img src="{listing_field_PHOTO_URL_value}" alt="Home For Sale" width="100" border="0"></a>";
    }
    else {
    echo "No Photo";
    }
    ?>
    Last edited by jcran; 11-08-2007 at 11:58 AM. Reason: Changes

  2. #2
    Join Date
    Nov 2004
    Posts
    453

    Default Re: Help with IF ELSE Statement

    Hi

    Make sure you have "execute php code" enabled in the site config first.

    Regards

    Paul

  3. #3
    Join Date
    Jun 2004
    Location
    Lakeland Florida
    Age
    47
    Posts
    74

    Default Re: Help with IF ELSE Statement

    Yeah, I did, still not right. I am sure my code is wrong, I am not the best programmer in the world.

  4. #4
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default Re: Help with IF ELSE Statement

    PHP code is executed before the template tags are replaced so the code is not going to work. You need to do it with an addon.

  5. #5
    Join Date
    Jun 2004
    Location
    Lakeland Florida
    Age
    47
    Posts
    74

    Default Re: Help with IF ELSE Statement

    Would that be a simple addon, I have no clue what I would need in the addon or what I wouldnt need?

    Do you see what I am trying to do PB?

  6. #6
    Join Date
    Jun 2004
    Location
    Lakeland Florida
    Age
    47
    Posts
    74

    Default Re: Help with IF ELSE Statement

    Can anyone help me with this?

  7. #7
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default Re: Help with IF ELSE Statement

    It would be a pretty simple addon. You would grab the listing ID ($currentID for the search results and $listingID for the listing page), and use that to get the value of the field you want. Then have it return the link or the no photo based on the value.

  8. #8
    Join Date
    Jun 2004
    Location
    Lakeland Florida
    Age
    47
    Posts
    74

    Default Re: Help with IF ELSE Statement

    How much would someone charge me to create an addon for images, preferably java rows.

    Here is what I would neeed:

    I have 2 image database fields, one includes how many photos are connected to the listing and the other field is the base url for the image. So, for example, if the quantity is 3 the links to photos would look like this.

    Image 1: http://www.website.com/imagename.jpg
    Image 2: http://www.website.com/imagename_01.jpg
    Image 3: http://www.website.com/imagename_02.jpg

    Can someone create an addon that can integrate this into a java rows type image display, if so, I would be willing to pay.

  9. #9
    Join Date
    Jun 2004
    Location
    Lakeland Florida
    Age
    47
    Posts
    74

    Default Re: Help with IF ELSE Statement

    Any have an idea how to do this?

  10. #10
    Join Date
    Dec 2006
    Posts
    317

    Default Re: Help with IF ELSE Statement

    As I understand it, you want more than one image in the search results page, is that correct?

    I don't think you need a database field for what you are trying to do, the addon can check how many photos there are in the listing and return what you want. I actually did something similar for the listings page for www.heroda360.com , there are basically 4 thumbnails on each side of the main image and then 6 per line underneath. You do not need special database fields, only make sure that the ones you want to be shown in the search results are 2, 3 in images order, and the first one is your main image. There is no need to give them special names.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •