Jump to content

Printer Freindly php


d239113g

Recommended Posts

I've having a little trouble with parse XML onto my page. 

 

Most is working, but i just cannot get the $RSS_link to work.

The link in the RSS to the article is

http://www.medicalnewstoday.com/articles/133241.php

 

but what i want to show is

http://www.medicalnewstoday.com/printerfriendlynews.php?newsid=133241

 

which is the printer friendly version of the article. At the moment with my script, it is displaying

http://www.medicalnewstoday.com/printerfriendlynews.php?newsid=

 

but not the article id

 

$rss_document = simpleXML_load_file('http://www.medicalnewstoday.com/rss/allergy.xml');

$url = "http://www.medicalnewstoday.com/printerfriendlynews.php?newsid=" . substr("$RSS_item->link", 41, -4);   

foreach($RSS_doc->channel->item as $RSS_item) {
        //The variable $RSS_item will hold a different item for each loop
        //Write the current item's title to the screen in HTML tags
        echo "<h3>$RSS_item->title</h3>";
        echo "<a href='$url'>$url</a><br />";
        echo "<b>$RSS_item->pubDate</b><br />";
        echo "$RSS_item->description<br /><br />";
    }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.