ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Links within Custom Fields

July 21, 2010 6:45pm

Subscribe [0]
  • #1 / Jul 21, 2010 6:45pm

    TristanM

    8 posts

    Hello everyone.  My apologies if something similar has been asked before.  I checked around and couldn’t find an answer (lord help me if it was staring me right in the face all along).

    Anyway, I’m setting up a site wherein content pages will have a header image.  I’ve created a custom field for this header.  What I’ve also done is created an alternate header image for ads, as well as a field for the ad link.

    {header_image}
    {ad_image}
    {ad_link}

    From there, I wrote a conditional so that if the entry doesn’t have a header image, it will instead display the ad image.

    {exp:channel:entries channel="news" limit="1" disable="categories|member_data|category_fields|pagination" require_entry="yes" status="open|featured"}
    {if header_image == ""}
    <a href="http://{ad_link}">{ad_image}</a>
    {if:elseif header_image != ""}
    <a href="http://{comment_url_title_auto_path}">{header_image}</a>
    {/if}
    {/exp:channel:entries}

    Now, the conditional works fine, however the link refuses to work.  I’ve set the Field Type to Text Input and Textarea without any difference.  Likewise, I’ve set the default text formatting to None.

    (Edit: when I enter the link in the ad_link field, I am not creating an actual link, but rather simply entering the URL.)

    But what happens is that (as an example):

    <a href="http://www.amazon.com">http://www.amazon.com</a>
    "> (BROKEN IMAGE LINK HERE)

    If I set the conditional to instead point to

    <a href="http://{ad_link}">

    then I get a broken link, but the image appears. (Quick edit, upon changing the template to remove the http://, I made certain that the link I put in the field entry only started at www).

    Gotta tell ya, I’m scratching my head on this one.  Any help would be appreciated.

    Thanks folks.

  • #2 / Jul 21, 2010 7:02pm

    Lisa Wess

    20502 posts

  • #3 / Jul 21, 2010 7:12pm

    TristanM

    8 posts

    My humble apologies.  I had not seen that.  Thank you for the fast reply and sorry to have wasted your time.

  • #4 / Jul 21, 2010 7:16pm

    Lisa Wess

    20502 posts

    Tristan, no need to apologize. We’re here to help =)

  • #5 / Jul 21, 2010 7:20pm

    TristanM

    8 posts

    I’d told clients and fellow designers often how incredible the admins are here, not to mention the strength of the product.

    You guys don’t disappoint, even when it’s a simple silly request.

    Thanks again.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases