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.

open link variable in new page

May 22, 2009 7:19pm

Subscribe [2]
  • #1 / May 22, 2009 7:19pm

    tamalita

    34 posts

    I have created a weblog with a list of upcoming films. One of the custom fields is the IMDB link for the film.

    I would like to have that link open in a new window. I am calling in the variable like this:

    {film_link}

    and it’s added to the list of details about the film.

    I would like that link to open in a new window. I know how to do that with basic html, but can’t seem to get it to work in EE.

    :roll:

  • #2 / May 22, 2009 8:34pm

    Mark Bowen

    12637 posts

    I would like that link to open in a new window. I know how to do that with basic html, but can’t seem to get it to work in EE.

    As ExpressionEngine allows you to output your data in any way you like then you should be able to do this just as though you were doing it in your normal HTML method.

    Perhaps you could show us what you have tried in your template so far?

    This kind of thing will work :

    {exp:weblog:entries weblog="default_site" disable="member_data|trackbacks|pagination|categories|category_fields"}
    <a href="http://{film_link}" title="{title}" target="_blank" rel="noopener">{title}</a>
    {/exp:weblog:entries}

    Personally I would say don’t use this method any more as it is deprecated code, you’d be better off going with a javascript solution instead such as Blank Win as it’s very easy to set up and your pages will then still validate correctly.

    The one main thing that you need to make sure is that the {film_link} custom field has its field formatting set to None and that you have the :

    Admin->Wevblog Administration->Weblog Management->Edit Preferences (Your Weblog)->Weblog Posting Preferences->Automatically turn URLs and email addresses into links?

    option set to No. This should then allow you to do what you need.

    Without seeing what you have tried though it’s a bit difficult to say though.

    Hope that helps a bit though.

    Best wishes,

    Mark

  • #3 / May 23, 2009 12:25am

    tamalita

    34 posts

    That was the exact code that I had used, but I didn’t have the preference set to No in the admin area. So, that solves the problem! However, I think I will follow your advice and use Blank Win.

    Thanks very much!

  • #4 / May 23, 2009 6:23am

    Mark Bowen

    12637 posts

    That was the exact code that I had used, but I didn’t have the preference set to No in the admin area. So, that solves the problem! However, I think I will follow your advice and use Blank Win.

    Thanks very much!

    No problem at all.

    Using the script I think is great as then you get the best of all worlds in that you don’t have to put links in any clever way into your system, the site validates and the script is totally automatic in only opening external sites in a new window. A win win situation really 😊

    Anyway hope it all goes well for you.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases