Hello,
How to make rss for one category from articles ex. (My Category). I want to show only articles from this category.
I try to do this with this code but cant ;(
<? header('Content-type: text/xml'); ?>
<rss version="2.0"> <channel> <title>Name of your site</title> <description>A description of your site</description> <link>http://boji-dar.info/m/articles/category/</link> <copyright>Your copyright information</copyright>
<? $q="SELECT caption, uri FROM bx_arl_entries WHERE categories='Българска Духовна Манна' DESC LIMIT 20"; $doGet=mysql_query($q);
while($result = mysql_fetch_array($doGet)){ ?> <item> <title> <?=htmlentities(strip_tags($result['caption'])); ?></title> <description> <?=htmlentities(strip_tags($result['uri'],'ENT_QUOTES'));?></description> <link>http://yoururl.com/pathtostory/and_page.php?</link> <pubDate> 3.12.32</pubDate> </item> <? } ?>
</channel> </rss>
Best wishes Bozhidar
|
|
Just go to the front end, and then the page that contains the said category. There will be an rss feed link at the top? Use it. This sentance says nothing, and its possibly spellt wrong. |
Just go to the front end, and then the page that contains the said category. There will be an rss feed link at the top? Use it.
On this page (m/articles/category/My+category) have not rss link in (/m/articles/index/) have rss link but for all articles.
|
|
Why dont you post a link to your site. I am not sure, but I am thinking there is no setting to turn the rss link on or off, so it should be there.
You need no code to display a rss feed. Just use the pre made rss blocks available in the page builder. Send a link, and Ill tell you your feed.
This sentance says nothing, and its possibly spellt wrong. |
My site is Bulgarian http://boji-dar.info |
Now i make connection with bd, with this code
<? header('Content-type: text/xml');
DEFINE ('DB_USER', 'xxx'); DEFINE ('DB_PASSWORD', 'xxx'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'xxx');
$rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $rssfeed .= '<rss version="2.0">'; $rssfeed .= '<channel>'; $rssfeed .= '<title>My RSS feed</title>'; $rssfeed .= '<link>http://www.mywebsite.com</link>'; $rssfeed .= '<description>This is an example RSS feed</description>'; $rssfeed .= '<language>en-us</language>'; $rssfeed .= '<copyright>Copyright (C) 2009 mywebsite.com</copyright>';
$connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to database'); mysql_select_db(DB_NAME) or die ('Could not select database');
$query = " SELECT * FROM `bx_arl_entries` WHERE `categories`='Българска Духовна Манна'" ; $result = mysql_query($query) or die ("Could not execute query");
while($row = mysql_fetch_array($result)) { extract($row);
$rssfeed .= '<item>'; $rssfeed .= '<title>' . $title . '</title>'; $rssfeed .= '<description>' . $description . '</description>'; $rssfeed .= '<link>' . $link . '</link>'; $rssfeed .= '<pubDate>' . date("D, d M Y H:i:s O", strtotime($date)) . '</pubDate>'; $rssfeed .= '</item>'; }
$rssfeed .= '</channel>'; $rssfeed .= '</rss>';
echo $rssfeed; ?>
But cant display anything. In `bx_arl_entries` have some fields (caption, content, when, uri). How to make other part of rss (for displaying URL, some text from article, title, date) ?
Best wishes Bozhidar
|
I dont know about the code you used. Thats a tough one.
But for some reason, you have no rss feed from your categories, and I see no way to turn that option on or off. Did you somehow stop the rss function that is already set up in the dolphin platform?
Normally there is a little rss feed button at the top of each category. You would normally click it, take your feed url, and simply put it in the rss feed block available in page builder.
I have no help to offer without your normal rss feed there.
This sentance says nothing, and its possibly spellt wrong. |
I found a solution :). Here is code
<? //Rss Bozhidar Iliev header('Content-type: text/xml');
DEFINE ('DB_USER', 'user_for_dbt'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'db_name');
$rssfeed = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $rssfeed .= '<rss version="2.0">'; $rssfeed .= '<channel>'; $rssfeed .= '<title>My Title</title>'; $rssfeed .= '<link>www.mysite.com</link>'; $rssfeed .= '<description>RSS Description </description>'; $rssfeed .= '<language>en-us</language>'; $rssfeed .= '<copyright>Copyright (C) 2011website.com</copyright>';
$connection = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to database'); mysql_select_db(DB_NAME) or die ('Could not select database');
$query = " SELECT * FROM `bx_arl_entries` WHERE `categories`='name_of_category' ORDER BY `bx_arl_entries`.`when` DESC LIMIT 0, 10" ; $result = mysql_query($query) or die ("Could not execute query");
while($row = mysql_fetch_array($result)) { extract($row);
$rssfeed .= '<item>'; $rssfeed .= '<title>' . $caption . '</title>'; $rssfeed .= '<description>' . $snippet . '</description>'; $rssfeed .= '<link>yourURL to the articles (http://xxx/m/articles/view/) ' . $uri . '</link>';
$rssfeed .= '</item>'; }
$rssfeed .= '</channel>'; $rssfeed .= '</rss>';
echo $rssfeed; ?>
Best Wishes Bozhidar
|