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.

Link in custom field

September 29, 2009 1:49am

Subscribe [6]
  • #1 / Sep 29, 2009 1:49am

    mgreich

    8 posts

    I’m trying to create a very simple portfolio weblog. The custom fields are title, portfolio_image, and portfolio_link. For some reason I cannot get a link to work using the {portfolio_link} tag. I’m pretty certain this is very simple, but for some reason I can’t get it to work.

    Here’s the code I have:

    <div id="mainContent">
       <h1> Portfolio </h1>
       {exp:weblog:entries weblog="portfolio" } 
    
       <div id="portfolioEntry">
        <div id="rightColumn">
           <a href="http://{portfolio_link}">{portfolio_image}</a>
        <!-- end #rightColumn --></div>
         <div id="leftColumn">
        <h2>{title}</h2>
    <p>    {site_info}  <br />
        <a href="http://{portfolio_link}">Visit the site</a><br />
       <!-- end #leftColumn --></div><br />
       <!-- end #portfolioEntry --></div><br />
       </p>
    
    <p>   {/exp:weblog:entries}


    This is the portfolio I’m trying to get (fyi…just a test portfolio now so the images and links are screwy). And here is the portfolio I’m getting.

    I have to be missing something simple here…this shouldn’t be that difficult. Does anyone have any ideas?

    Thanks.

  • #2 / Sep 29, 2009 4:42am

    tonyd3

    13 posts

    HAHA!  I was just about to post a question on the exact same thing.

    I have a custom field named ‘site_link’ that is a text input with default formatting set to ‘None’.

    In the template, within {exp:weblog:entries} tags, I have the following:

    <a href="http://{site_link}class=goto">Go To Site</a>

    However this comes out wrong on the front end, and ends up looking like this:

    http://www.domain.com”>go to Site

  • #3 / Sep 29, 2009 5:32am

    Ingmar

    29245 posts

    Make sure to turn off “Automatically turn URLs and email addresses into links?” here
    .

  • #4 / Sep 29, 2009 10:33am

    mgreich

    8 posts

    That did it. Thanks a ton Ingmar. That one is definitely going in the memory bank.

  • #5 / Sep 29, 2009 12:33pm

    ewn

    100 posts

    Works here too!  Thanks Ingmar.

    Say - is there a way to make this a conditional so that it shows up only if the field has something in it?

  • #6 / Sep 29, 2009 1:00pm

    ewn

    100 posts

    for anyone else, I was able to accomplish this with:

    {if site_link !=''}
    <a href="http://{site_link}class=goto">Go To Site</a>
    {/if}
  • #7 / Oct 02, 2009 7:43pm

    jtoast

    32 posts

    Yay! Thanks for the answer, Ingmar. Love this forum.

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

ExpressionEngine News!

#eecms, #events, #releases