CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 27th, 2004, 03:28 PM
Futurama56 Futurama56 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 17 Futurama56 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Popping a new window after reading a CSS

this is my code

PHP Code:
<?php
// XML file
$file "http://www.wired.com/news/feeds/rss2/0,2610,12,00.xml";

// set up some variables for use by the parser
$currentTag "";
$flag "";
$count 0;

// this is an associative array of channel data with keys ("title",
//"link",
//"description")
$channel = array();

// this is an array of arrays, with each array element representing an
//<item> // each outer array element is itself an associative array 
// with keys ("title", "link", "description")
$items = array();

// opening tag handler
function elementBegin($parser$name$attributes)
{
    global 
$currentTag$flag;
    
$currentTag $name;
    
// set flag if entering <channel> or <item> block
    
if ($name == "ITEM")
    {
  
$flag 1;
    }
    else if (
$name == "CHANNEL")
    {
  
$flag 2;
    }
}

// closing tag handler       
function elementEnd($parser$name)
{
    global 
$currentTag$flag$count;
    
$currentTag "";

    
// set flag if exiting <channel> or <item> block
    
if ($name == "ITEM")
    {
  
$count++;
  
$flag 0;
    }
    else if (
$name == "CHANNEL")
    {
  
$flag 0;
    }
}

// character data handler
function characterData($parser$data)
{
    global 
$currentTag$flag$items$count$channel;
    
$data trim(htmlspecialchars($data));
    if (
$currentTag == "TITLE" || $currentTag == "LINK" ||
$currentTag ==
"DESCRIPTION")
    {
  
// add data to $channels[] or $items[] array
  
if ($flag == 1)
  {
      
$items[$count][strtolower($currentTag)] .=
$data;
  }
  else if (
$flag == 2)
  {
      
$channel[strtolower($currentTag)] .= $data;
  }
    }

}

// create parser
$xp xml_parser_create();

// set element handler
xml_set_element_handler($xp"elementBegin""elementEnd");
xml_set_character_data_handler($xp"characterData");
xml_parser_set_option($xpXML_OPTION_CASE_FOLDINGTRUE);
xml_parser_set_option($xpXML_OPTION_SKIP_WHITETRUE);

// read XML file
if (!($fp fopen($file"r"))) 
{
      die(
"Could not read $file");
}

// parse data
while ($xml fread($fp4096)) 
{
    if (!
xml_parse($xp$xmlfeof($fp))) 
    {
  die(
"XML parser error: " .
xml_error_string(xml_get_error_code($xp)));
    }
}

// destroy parser
xml_parser_free($xp);

// now iterate through $items[] array
// and print each item as a table row
$i 0;

foreach (
$items as $item)
{

if (
$i 2)
{
break;
}


    echo 
"<tr><td><a href=" $item["link"] . ">" $item["title"] .
"</a><br>" $item["description"] .  "</td></tr>";

$i++; 

}
?>


this is the part that generates what parts of the RSS you see, and the links...

PHP Code:
// now iterate through $items[] array
// and print each item as a table row
$i 0;

foreach (
$items as $item)
{

if (
$i 2)
{
break;
}


    echo 
"<tr><td><a href=" $item["link"] . ">" $item["title"] .
"</a><br>" $item["description"] .  "</td></tr>";

$i++; 

}
?> 


How can I get the links displayed to pop in a new window, much like this...

PHP Code:
<a href="http://www.google.com/" target="_new"This will pop in a new window(RAPP) ... 


basically, make the headers(which are links), to do _new window

Reply With Quote
  #2  
Old April 27th, 2004, 03:34 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Click here for more information.
 
Join Date: Feb 2002
Location: Finland
Posts: 8,912 jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)jabba_29 User rank is General 11st Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 4 Weeks 1 Day 12 h 41 m 36 sec
Reputation Power: 1693
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
'Spose this it too obvious:
PHP Code:
echo "<tr><td><a href=\"" $item["link"] . "\" target=\"_blank\">" $item["title"] .
"</a><br>" $item["description"] .  "</td></tr>"
BTW, are you going to using this through a newsreader?
__________________
Cheers,

Jamie

# mdb4u | mobile movie database] | Please help to test and promote
# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.



__________________

Reply With Quote
  #3  
Old April 27th, 2004, 04:14 PM
Futurama56 Futurama56 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 17 Futurama56 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks for the quick reply! worked great!

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Popping a new window after reading a CSS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT