Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-02-09 16:44:35
- Champak
- Member
- Registered: 2006-01-31
- Posts: 56
Website feed
Is there a way to feed the latest article into a website page outside of textpattern…..using only the excerpt, article pic, and title?
Offline
Re: Website feed
One could parse the RSS feed of their website on another website. Using such tools as Magpie RSS. If the “other” site is powered by textpattern there’s even a plugin for it tcm_rss
Last edited by 1beb (2006-02-11 00:01:11)
Proud Canadian. Toronto Locksmith , Actualize Consulting
Offline
Re: Website feed
I use Feed2JS which uses Magpie RSS and converts feeds to a Javascript that can be inserted into articles, forms or pages. It was easier for me to install this than trying to install Magpie then getting it to work with TXP.
Ren
Offline
#4 2006-02-11 04:21:57
- Champak
- Member
- Registered: 2006-01-31
- Posts: 56
Re: Website feed
This is what I’ve done so far, and hopefully I can get the help for the rest of the way because I know absolutely nothing about RSS.
1/ I grabbed lastRSS and magpie to parse. I have a problem with both. a) With lastRSS, unless there is something I’m not seeing, there is no way to get anything except the basics of a feed——description, title, url. But it works perfectly(without problems), and I can integrate it with no problems. b) With magpie, one minute it works the next it doesn’t…literally, sometimes if I press refresh or come back to the page, it is just gone. No specific interval or indicator of why and when it will happen…is this normal? Is there some setting I’m missing? Some time down the line, no specific noticeable time frame, I press refresh and it’s back. Does anyone know why this happens?…I see a few people mention magpie so hopefully others have experienced this.
2/ I have the admin set to show excerpts, but all I’m getting is the title, description, and link as I said earlier. I thought description would have been the article(in its excerpt format since that is what I have set), but alas it is not. I want the title, excerpt and article picture. I’ve searched through over 50 threads and to my extreme surprise not one thread here indicates how to call a textpannel feed article from another page or how to display the articles in the feed.
My feed call is as follows:
<code>
require_once ‘/home/XXXXX/public_html/models/feed/rss_fetch.inc’;
</code><code>
$url = ‘http://www.XXXXX.com/models/index.php?rss=1&limit=1’;
$rss = fetch_rss($url);
</code><code>
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[link];
$description = $item[description];
</code><code>
echo “Site: “, $rss->channel[‘title’], “<br> “;
echo “<a href=$url>$title</a><br>”;
echo “$description “;
}
</code>
And I have this in my default page head if it matters:
<code>
<link rel=“alternate” type=“application/rss+xml” title=“RSS” href=“http://www.gpcommunity.com/models/index?rss=1” />
<link rel=“alternate” type=“application/atom+xml” title=“Atom” href=“http://www.gpcommunity.com/models/index?atom=1” />
</code>
I also added the following to the rss.php to get images:
<code>
if ($a[‘Section’] == “Models”)
{
$img_url = hu.“images/”.$a[‘Image’].’.jpg’;
$Body = doSpecial(‘<a href=”’.permlinkurl($a).’”><img src=”’.$img_url.’” alt=“the latest and greatest” /></a>’);
}
</code>
I thought once I added that, the images would automatically appear, but alas they do not.
Epilogue, can someone tell me why magpie is “breaking” unexpectedly, and how to call the article and images please? Or better yet, if someone knows LastRSS, how to get what I want in that.
P.S. why are my BBCodes turned off in this forum?
Last edited by Champak (2006-02-11 04:24:44)
Offline
#5 2006-02-11 08:50:23
- alexandra
- Member
- From: Cologne, Germany
- Registered: 2004-04-02
- Posts: 1,370
Re: Website feed
I use Feeddigest on the german TXP Blog .. see column in the middle -> ‘Externer Feed : textpattern.org’ .
Offline
Re: Website feed
For magpie, I was using this…
<code>
<?php
echo “<ul>”;
require($_SERVER[‘DOCUMENT_ROOT’].”/includes/magpierss-0.61/rss_fetch.inc”);
$url=“http://www.link.to/xml.xml”;
$rss = fetch_rss( $url );
$feed = $rss->items0;
$realurl = $feed[‘link’];
$realtitle = $feed[‘title’];
echo “<li><a href=\”$realurl\”>$realtitle</a></li>”;
echo “</ul>”;
?>
</code>
That’s a fairly simple usage though. If you’re having problems with either of those two software packages I might suggest that you look through their individual FAQ’s as they would more than likely have more succinct and direct information regarding usage.
P.S This forum uses textile
Last edited by 1beb (2006-02-11 21:05:56)
Proud Canadian. Toronto Locksmith , Actualize Consulting
Offline
#7 2006-02-12 08:59:02
- Champak
- Member
- Registered: 2006-01-31
- Posts: 56
Re: Website feed
Thanks, but that doesn’t seem to do it for me either. I just went ahead and made a database query to import the most recent article the way I want it to my website
Offline
Re: Website feed
[code]
require($_SERVER[‘DOCUMENT_ROOT’].”/magpierss/rss_fetch.inc”);
$url=“http://www.mydomain.com/news/rss/”;
$rss = fetch_rss( $url );
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[link];
$description = $item[description];
echo “<h4><a href=$url>$title</a></h4>”;
echo “<p>$description</p>”;
}[/code]
Edit:: BBCode: off sorry, but it does work..
Works for me :)
Last edited by Gareth (2006-02-24 14:04:06)
Offline
Re: Website feed
Adding images works for me:
rss.php
Place this code at the end of the $Body tags!!
[code]
if ($a[‘Image’])
{
$img = $a[‘Image’];
$Body = $Body . doSpecial($img);
}
[/code]
and on the page to dispay it I have:
[code]
require($_SERVER[‘DOCUMENT_ROOT’].”/magpierss/rss_fetch.inc”);
$url=“http://www.mydomain.com/climbing-news/rss/”;
$rss = fetch_rss( $url );
foreach ($rss->items as $item ) {
$title = $item[title];
$url = $item[link];
$description = $item[description];
echo “<h4><a href=$url>$title</a></h4>”;
echo “<p>$description</p>”;
}
[/code]
Offline
Pages: 1