Adding an Extra Field that is clickable

Discussion in 'Templates, HTML, CSS, and Design Help' started by sporthorsebreeder, Apr 9, 2006.

  1. Hello
    I want to add two extra fields to the listings that I can enter an external link in the same way that the Website Field is setup.
    I tried adding a new extra field and entering the html code for the link but when it showed in the listing it was not clickable the way the Website field is. It only showed the text.
    Can anyone tell me how to do it.
    Thanks for any help.
    Cheers
    Hugh
  2. Eric Barnes Guest

    Hugh,

    I have just recently made this same change. I will see if I can't locate the code tommorow and let you know how I did it.
  3. Hello Eric
    Did you come across that code yet
    Cheers mate
    Hugh
  4. Eric Barnes Guest

    Sorry I got side tracked.

    I believe how I did was like this:
    Code:
    {if isset($extras.value)}
                         {foreach key=key item=item from=$extras.value}
                              {if $extras.fID==4 || $extras.fID==5}
                                {$item|linkurl:30}
                            {else}
                            {$item}
                            {/if}
                          {/foreach}
                         {/if}
    
    You would change this line to the field id of the extra fields.
    {if $extras.fID==4 || $extras.fID==5}

    To get these values you should be able to place {$extras.fID} before the {$item}
  5. Hello Eric
    Thanks for the code
    Which file to I find the code in, or do I have to insert this code into a file?
    Sorry for the dumb question, but I am new to PHP.
    Cheers
    Hugh
  6. Eric Barnes Guest

    Sorry I should have included that.

    It will be the template file viewlistings.tpl.php or viewlistings2.tpl.php the first one is the standard with the images on the side where viewlistings2 has the images on top.
  7. Hello Eric
    I am just about to try this.

    Where do I find the field id for the extra fields.
    I had a look in the administration section but could not find them there.
    Cheers
    Hugh
  8. Eric Barnes Guest

    To get these values you should be able to place the following:
    ID: {$extras.fID}
    Before
    {$item}

    In that same file.

    If nothing is printed then let me know because there might be another step I am missing. Also are you running the developer edition?
  9. Hello Eric
    Yes I am running the Developer version.
    I looked all through viewlisting.tpl.php and there is no mention of id for the extra fields.

    I inserted
    {if isset($extras.value)} {foreach key=key item=item from=$extras.value} {if $extras.fID==4 || $extras.fID==5} {$item|linkurl:30} {else} {$item} {/if} {/foreach} {/if}
    into line 60 before the {$item} but it made no difference.
    The example page I want to have the clickable field is the Six Generation Pedigree:field on http://www.thoroughbreddiaries.com/viewlisting.php?view=3

    Any idea where I would find the id for the extra fields, or do I need to do something else.
    Cheers
    Hugh
  10. Eric Barnes Guest

    It should be working now. Since I had your ftp details I just went in and fixed it.
    1 people like this.
  11. Eric
    Your a Star
    Cheers mate
    Hugh
  12. deebee Customer

    I'm looking for the same solution but can't find which line to place this mod...

    EDIT: Hasty post -found it now!

Share This Page