Results 1 to 7 of 7

Thread: Add an IF statement

  1. #1
    Join Date
    Mar 2008
    Posts
    5

    Default Add an IF statement

    How can i add and IF statment into the template files.

    In other words something like this:
    {if field_5 == 'active'}
    <span class='somthing'>{field_5}</span>
    {else if field_5 == 'not'}
    <span class='somethingelse'>{field_5}</span>
    {/if}

    I've worked in smarty before and was trying different things but can't get it

    Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    California
    Age
    43
    Posts
    4,229

    Default Re: Add an IF statement

    you can add PHP code to the templates using the documented methods.

    personally I'd bypass the idea of php and if statements and just write what you're trying to do like this:

    <span class='{listing_field_FIELDNAME_value}'>{listing_f ield_FIELDNAME}</span>


    and then create a CSS class for all the possible values. IE, Active, Sold, Pending etc can all have a unique class and settings. Of course this wouldn't be practical for a field with lots of possible values but from the description of the field you provided I'd guess that's not going to be the case
    Open-Realty 2 Documentation

    ~The Difference Between an ORDEAL and an ADVENTURE is ATTITUDE~

  3. #3
    Join Date
    Mar 2008
    Posts
    5

    Default Re: Add an IF statement

    Thanks for the fast reply.
    Do you have a link to the documented methods?

    I try doing a search in both the wiki and the forum and can't since the term PHP is only 3 characters.

    Also......having an issue with image sizes:

    http://www.monk-consulting.com/twotr...ew&listingID=2

    Some of my images are wider then height.....and at the bottom of the images configuration options....i can't put in a null value to just have the image gets resized by width. Width being the most important.

    Seems like all the settings i try destort them

    Thanks Again

  4. #4
    Join Date
    Mar 2008
    Posts
    5

    Default Re: Add an IF statement

    Here is how they looked on the original site before switching to your software:

    http://www.twotreesre.com/search/qse...orm_display=30

  5. #5
    Join Date
    Jul 2003
    Location
    California
    Age
    43
    Posts
    4,229

    Default Re: Add an IF statement

    well disregard my statement about the documented methods and php, I had in my mind that you were trying to add stuff to a page editor page, not a listing detail template. for listing detail templates you would basically do it just like any normal php page however your host has to allow php execution on html pages, which is not a default setting so usually most hosts don't allow it.

    As for your images, the java change code is designed to display each image at a width of 400 px, since you are trying to display an image narrower than that its getting stretched and distorted.
    Open-Realty 2 Documentation

    ~The Difference Between an ORDEAL and an ADVENTURE is ATTITUDE~

  6. #6
    Join Date
    Mar 2008
    Posts
    5

    Default Re: Add an IF statement

    Took a vacation from this site......now coming back to it.

    So....the only way to add a switch statement is to actually use PHP in the html page???

    There is no other way? I was thinking the site was built with something like smarty templates

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

    Default Re: Add an IF statement

    OR uses it's own template engine. You either need to use php in the template file or create an addon.

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
  •