SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Mar 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    target="_blank" for the php link.

    Hello friends

    I want two of my links to open as target="_blank" but I am not sure where to give target="_blank" for the below link. Could you please help me fix this. Below is the link that I am trying to give target="_blank" so that it opens in a new window.

    "<li><a href=\"http://ebiz.bpc.co.in/soa\">SOA</a></li>\n";


    Thanks in advance.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    HTML anchor element basics http://www.w3schools.com/tags/att_a_target.asp

    PHP Code:
    echo "<li><a href=\"http://ebiz.bpc.co.in/soa\" target=\"_blank\">SOA</a></li>\n"

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    There are no "php links". Links are html.
    Just put the target part inside the <a> tag:
    Code:
    <a href=\"http://...\" target=\"_blank\">link</a>
    Off Topic:

    Oops, too slow

  4. #4
    SitePoint Member
    Join Date
    Mar 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot SgtLegend and guido2004.
    I just pasted the code and it works perfectly.
    I am new to php. Thanks to both of you again.


    Regards
    Arjun

  5. #5
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    No problem, i recommend you learn HTML before you continue with PHP as you will continue to find it difficult to understand. This is how i learn't...

    1. HTML
    2. CSS
    3. PHP
    4. MySQL
    5. JavaScript

  6. #6
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sort of on topic, but not PHP ... isn't the target="_blank" attribute now deprecated in the HTML specification? Yes, I know it still works - I sometimes use it myself - but will there come a time when the browsers stop supporting it?
    Ian Anderson
    www.siteguru.co.uk

  7. #7
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by siteguru View Post
    Sort of on topic, but not PHP ... isn't the target="_blank" attribute now deprecated in the HTML specification? Yes, I know it still works - I sometimes use it myself - but will there come a time when the browsers stop supporting it?
    The W3C standards doesn't say its deprecated http://www.w3.org/TR/2003/WD-WCAG20-...9/#links_popup

  8. #8
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    It was deprecated years ago. here is a discussion from 2004: http://www.sitepoint.com/forums/show...hreadid=198185
    and there are currently a couple of (heated) discussions about it!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  9. #9
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I think in today's tabbed-browser world then a lot of the comments raised there about new windows are now moot.

    But the JS alternatives to _blank are unreliable as it is a lot easier these days for people to block JS from running (either en masse or selectively). So like I said earlier, _blank may be deprecated but I do still use it sometimes.
    Ian Anderson
    www.siteguru.co.uk

  10. #10
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,837
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by siteguru View Post
    I think in today's tabbed-browser world then a lot of the comments raised there about new windows are now moot.
    In 1997 it was decided that it iis far more user friendly to allow your visitors to decide how they want pages to open. By getting rid of the target attribute when they designed HTML4 they ensured that those pages that follow the standards do not disable any of the alternatives when you right click on the link to select where to open it. With a target the page maps the "open" and "open in a new window" options to the same thing.

    When this was discussed in 2004 the target attribute had already been dead for 7 years. When you use target you are writing HTML3.2 (or earlier) and making your pages harder for your visitors to use.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  11. #11
    SitePoint Member
    Join Date
    Mar 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you SgtLegend and to all of you. I will start learning in order SgtLegend mentioned.

    Again thanks to you all for spending time to resolve my question.

    Regards
    Arjun


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •