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.

Channel field link to outside url

September 20, 2011 12:56pm

Subscribe [2]
  • #1 / Sep 20, 2011 12:56pm

    RedSixMedia

    7 posts

    Hello All,

    I am trying to allow the client to input a url to an external site through a channel entry but the link continues to display “http://mysite.com/

    ” before the url. I’ve read some entries on turning off the xhtml, etc. but nothing seems to work correctly. Any suggestions?

    {exp:channel:entries channel="newsletter" status="open" paginate="bottom" limit="3"}
                        <li>
                        <article class="thePush">
                            <div class="date">{entry_date format="%F %d, %Y"}</div>
                                <div class="caption">
                                    <h2><a href="http://{newsletter_excerpt}" class="title">{title}</a></h2>
    <p>                                <a href="http://{newsletter_excerpt}" class="continue">Continue reading »</a><br />
                                </div><br />
                        </article><br />
                        </li><br />
                    {paginate}<br />
                        Page {current_page} of {total_pages} pages {pagination_links}<br />
                    {/paginate}<br />
                    {/exp:channel:entries}

  • #2 / Sep 20, 2011 7:37pm

    John St-Amand

    865 posts

    Is {newsletter_excerpt} the link field?  It’s not leaping out at me.

  • #3 / Sep 20, 2011 9:41pm

    RedSixMedia

    7 posts

    Yes, {newsletter_excerpt} is the field where I am adding an external url.

  • #4 / Sep 20, 2011 10:18pm

    John St-Amand

    865 posts

    Ok, by the look of it, there are two things with your custom field:

    1) under field options, make sure you set “Default Text Formatting for This Field” to “none” (the are appearing likely because it is or has been set to XHTML)

    2) external links must include http:// or they will try to link internally (hence the mysite.com being in your url).  The easy way to foolproof that is to use the custom field add-on VZ URL.  It automatically inserts the http:// for you in the field (though still giving you the ability to overwrite it if needed) and it uses Ajax to verify if the URL entered is valid (and gives you a little green check if it is, red X if it is not) so it’s a great way to double check the entered value if it’s a url.  You have to install the add-on, install VZ URL as a field type, and then change your field type on {newsletter_excerpt} to the VZ URL field type to use it.  I use it all the time - it’s a subtle but great little field type to use.

    Hope that helps.

  • #5 / Sep 21, 2011 12:11pm

    RedSixMedia

    7 posts

    Hey John St-Amand,

    I wanted to say thanks for the help.
    The first choice did not work but VZ URL did.
    Thanks!

  • #6 / Sep 21, 2011 12:13pm

    John St-Amand

    865 posts

    No problem.  The first item was simply to eliminate the tags that were appearing.  The second was simply to give you (or your client) a visual and programmatic reminder to include the http part in the URL to ensure that the browser did not interpret the link as an internal one.

    Glad it worked out for you.

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases