Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author john ackers

    (@john-ackers)

    On your website, it looks like you have quotes around the the string in the ‘Amazon’ column, so the HTML is not being processed by the browser as such.

    What database field(s) do you have in the database? Link, image or a string of HTML? Do you want the clickable link to contain text or an image? Let me know and I’ll give you the SQL and PHP code.

    This section in the FAQ ‘How can i show images in a table column and make them clickable links?’ might help.

    Use the “target” attribute to force browser to open a new window.

    Thread Starter Joetabush

    (@joetabush)

    Thanks for the quick reply…

    I’ve revised my database so it now includes just the Link Address. If you use the same link above to my site, you will see that the table displays the link address. (if you click the link in my original post, you will see that it now displays the text of the link address).

    Ideally, I would like it to display clickable TEXT which reads “open on Amazon”, and has the target attribute for new window, to open to the link from the database. Also, if the field is in the database in blank, do not display anything.

    If possible, please provide me PHP snippet to insert in the header.

    Thanks very much,
    Joey

    Plugin Author john ackers

    (@john-ackers)

    OK. This PHP snippet works for me:
    return empty($value) ? "" : "<a href='".$value."' target='_blank' >open on Amazon</a>";

    Thread Starter Joetabush

    (@joetabush)

    awesome!! works perfect. thank you.

    Thread Starter Joetabush

    (@joetabush)

    Hey-
    this was working just fine… I’m not sure what change I made, but now when I click the link, it opens a new tab but loads up the SAME page I was on, on my site when I clicked… Any idea what could have caused this change?

    Thanks.

    Plugin Author john ackers

    (@john-ackers)

    Lots of possibilities. Suspect that the links don’t start with https:// or https://.

    Plugin Author john ackers

    (@john-ackers)

    Try this:

    $url=trim($value);
    return empty($url) ? "" : "<a href='".$url."' target='_blank' > Amazon</a>";

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘External Links to Open in New Window’ is closed to new replies.