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.

Problem with links pulled in from custom fields

January 12, 2012 5:16am

Subscribe [3]
  • #1 / Jan 12, 2012 5:16am

    brash

    10 posts

    I’m having a problem pulling links in from custom fields, in that they don’t always work :(

    I have a custom field for the user to enter a URL which is then applied to a button:

    <a href="http://{featured_link_1}%22class=%22ctaButton" class="ctaButton first"><span>{featured_button_1}</span></a>

    When I enter a link with http:// at the beginning (eg. http://www.google.co.uk) it tries to go to http://mywebsite/www.google.co.uk

    If I lose the http:// and just enter http://www.google.co.uk, the code gets completely screwed up - I’ve copied and pasted the result from Firebug:

    <a href="http://a" class="ctaButton first">http://www.google.co.uk</a>
    ">

    My custom field has ‘Default Text Formatting’ set to ‘None’.

    Any ideas anyone? Thanks in advance

  • #2 / Jan 12, 2012 9:42am

    Design by Front

    106 posts

    Hey there,

    By default channel entries will automagically try to convert urls into links.

    You can turn this option off in the channel’s preferences by going to Admin > Channel Administration > Channels > Channel Preferences > Channel Posting Preferences. Set the option for “Automatically turn URLs and email addresses into links?” to No.

    If you’re interested, Trevor Davis built a plugin which turns this option off automatically for you for new channels, as it can be a little annoying 😉

    Hope this helps,
    Chuck

  • #3 / Jan 12, 2012 10:09am

    brash

    10 posts

    Excellent, very handy little plugin - thanks! 😊

  • #4 / Jan 13, 2012 4:30pm

    Dan Decker

    7338 posts

    Hi design@brash,

    Did Design by Front’s suggestion get you on the right track? Is there anything else we can assist you with?

    Cheers!

  • #5 / Aug 12, 2012 12:20pm

    Mutter

    5 posts

    so glad I found this thread - solved a very annoying problem!
    But would it be better if there was a way to turn off auto-links by field? I could see wanting auto-links in some fields and not in others in the same channel

  • #6 / Aug 13, 2012 3:39pm

    Dan Decker

    7338 posts

    Hi Mutter,

    Indeed, by field would be much more flexible. The plugin referenced is 3rd party, so you can contact the author with a feature request.

    Or, if you like, you can make a Feature Request to have it added to ExpressionEngine!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases