adding php rss reader?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
techfaqhelp
Posts: 4
Joined: Wed Jun 15, 2011 5:46 pm

adding php rss reader?

Post by techfaqhelp »

I know this seems odd, but I generated a php script which works as an rss reader. I want to place the last 3 items from the rss feed above the top articles, and then change the number of top articles from ten to five to make space.

It would seem that for obvious security reasons, I cannot just place this in the index.tpl file. Where would be the correct place to add this php? Also, where can I change the number of top faqs?

Many Thanks in advance!

Ryan

Here is what I am trying to add:
<?php
require_once("rsslib.php");
$url = "http://helpdesk-smumn.blogspot.com/feed ... lt?alt=rss";
echo RSS_Links($url, 5, false, true);
?>
jason102178
Posts: 200
Joined: Tue Nov 02, 2010 9:08 am
Location: United States-Ohio
Contact:

Re: adding php rss reader?

Post by jason102178 »

I can parcially answer your question, if you want to change the number of your top ten you would have to edit config/constant.php line74
phpMyFAQ Quality Assurance / Forum Moderator
Amazon.com Wishlist
JochenS
Posts: 121
Joined: Wed Feb 16, 2011 3:51 pm
Location: Schönaich
Contact:

Re: adding php rss reader?

Post by JochenS »

Hi,

I would add a template page (check this: http://faq.phpmyfaq.de/content/11/9/en/ ... t=template). and add this to the index.tpl.

Jochen
Our public FAQ is proudly powered by phpMyFAQ: http://vhtfaq.ge51.honeywell.de/
techfaqhelp
Posts: 4
Joined: Wed Jun 15, 2011 5:46 pm

Re: adding php rss reader?

Post by techfaqhelp »

I was able to figure it out. Here is what I did:
I copied the php library file phplib.rss to /inc/libs

Added this to index.php:

require_once("inc/libs/rsslib.php"); $url = PATH TO RSS FEED"; $rssfeed = RSS_Links($url, 3, false, true);

Then add the variable to the $main_template_vars array, like this:
'rssfeed' => $rssfeed,

In my index.tpl file, I added this:
{rssfeed}

Works perfectly, just wanted to post this in case anyone else was trying to do something similar.

Thanks!
Ryan
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: adding php rss reader?

Post by Thorsten »

Hi,

thanks for sharing!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Cookie
Posts: 2
Joined: Fri Jun 29, 2012 5:09 pm

Re: adding php rss reader?

Post by Cookie »

techfaqhelp wrote:I was able to figure it out. Here is what I did:
I copied the php library file phplib.rss to /inc/libs

Added this to index.php:

require_once("inc/libs/rsslib.php"); $url = PATH TO RSS FEED"; $rssfeed = RSS_Links($url, 3, false, true);

Then add the variable to the $main_template_vars array, like this:
'rssfeed' => $rssfeed,

In my index.tpl file, I added this:
{rssfeed}

Works perfectly, just wanted to post this in case anyone else was trying to do something similar.

Thanks!
Ryan
It looks like a nice solution. As soon as I get home I will try this immediatelly. Thanks for the nice description!
Gotta go back in time
Post Reply