Jump to content

RSS Feeds creation driving me nuts! Please Help!


brent123456

Recommended Posts

I can seed to get anything more then the Title and the Description to print out in Firefox and IE. I can't for the life of me figure out why? I am not getting any of the items to print out in the Browser under the title and discriptions. Please help. I add this line to the apache configure file AddType application/x-httpd-php .xml and restarted and still nothing. This is driving me nuts please help. ???

 

<?php
  
  require_once ('mysql_connect.php'); //connection page
  
  $query ="SELECT * FROM product_table ORDER BY date_Posted DESC LIMIT 0,2";
  
  $rsstitle = 'The Products';
  $rssdesc = 'View the newest Products';
  $rsslink = 'http://www.example.com;
  
  if ($result = mysql_query($query)) {
    header("Content-Type: application/xml; charset=ISO-8859-1"); 
    $output .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";     
   $output .= "<rss version=\"2.0\">\n";
    $output .= "<channel>\n";
    $output .= "<title>".$rsstitle."</title>\n"; // the title of the feed
    $output .= "<description>".$rssdesc."</description>\n"; // small description
    $output .= "<link>".$rsslink."</link>\n";
      
   $output .= "<product>\n";
      
   while ($row = mysql_fetch_assoc($result)) {  
    $output .= "<item>\n";
    
    $output .= "<title>\n" . htmlentities(strip_tags($row['name'])) . "</title>\n";  
    $output .= "<date>" . htmlentities(strip_tags($row['date_Posted'])) . "</date>\n";
    $output .= "<type>" . htmlentities(strip_tags($row['product_type'])) . "</type>\n";
    $output .= "<environment>" . htmlentities(strip_tags($row['environment'])) . "</environment>\n";
    $output .= "<discription>" . htmlentities(strip_tags(substr($row['discription'],0,140))) . "</discription>\n";
    
    $output .= "</item>\n";
    
   }
   
   $output .= "</product>\n"; 
   $output .= "</channel>\n</rss>\n";    
    echo $output;   
      
  } else {
      
   $output .= 'Sorry, We can't get a product at this time.';   
   
   echo $output;   
  }
  ?>

 

This is what it has when i view page source

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>The Products</title>
<description>View the newest Products</description>
<link>http://www.example.com</link>
<strains>
<item>
<title>
Chain Saw</title>
<date>2007-07-08</date>
<type>Outdoors</type>

<environment>Outdoors/Wood Products</environment>
<discription>Great New Chain Saws</discription>
</item>

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.