There may be times when you want to open all links from an external feed in a new window. There are a few things to take into account when doing this:
- It's bad practice to hard-code your event handlers to your code, so we'll want to separate it from our HTML as much as humanly possible.
- We're going to strictly adhere to the notes in YoungPup's How to create popups tutorial.
This tutorial assumes that you're already familiar with using SimplePie, including looping through items. This is only sample code, and you should not create real pages using the (horrid) HTML generated by this example.
- Supported in SimplePie 1.0.
- Code in this tutorial should be compatible with PHP 4.3 or newer, and should not use PHP short tags, in order to support the largest number of PHP installations.
- This solution requires a modern web browser. 2001's Internet Explorer 6.0 is the least capable of the previous generation web browsers, so this will be our baseline browser.
Save the following source as a page and view it in your browser. You should be able to do a normal left-click to open the links in a new window, right-click to see all available contextual menu options, or middle-click to open the page in a new tab (in most current generation web browsers).
tutorial/how_to_make_description_links_open_in_a_new_window.txt · Last modified: 2011/03/05 19:56 (external edit)