Goofy problem with Top 10 RSS feed.

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
three_sixteen
Posts: 11
Joined: Mon Jan 22, 2007 11:42 pm
Contact:

Goofy problem with Top 10 RSS feed.

Post by three_sixteen »

It dosen't seem to be updating... the five questions posted most recently RSS feed updates, but not the top ten.. the news RSS isn't updating either.

Interestingly enough, the column in the FAQ will update, but when I try to view the RSS XML it dosen't display any of the items. No errors are returned either.

It's on a MSSQL database -- it works fine on my test MySQL database. This is beyond frustrating.

What am I missing here?
three_sixteen
Posts: 11
Joined: Mon Jan 22, 2007 11:42 pm
Contact:

Post by three_sixteen »

I've commented out the XML prodcution in rss.php this is what the SQL query is:

Code: Select all

SELECT DISTINCT faq_faqdata.id AS id, faq_faqdata.lang AS lang, faq_faqdata.thema AS thema, faq_faqcategoryrelations.category_id AS category_id, faq_faqvisits.visits AS visits, faq_faqdata.datum AS datum, faq_faqvisits.last_visit AS last_visit FROM faq_faqvisits, faq_faqdata LEFT JOIN faq_faqcategoryrelations ON faq_faqdata.id = faq_faqcategoryrelations.record_id AND faq_faqdata.lang = faq_faqcategoryrelations.record_lang WHERE faq_faqdata.id = faq_faqvisits.id AND faq_faqdata.lang = faq_faqvisits.lang AND faq_faqdata.active = 'yes' ORDER BY faq_faqvisits.visits DESC
This query returns no results from my database.
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
it could be an issue in the SQL query: right for MySQL, wrong for MSSQL. Which version of MSSQL are you using?
BTW, you could perform the query in the Query Analiser/ Management Studio and find out if any error is arised.

Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
three_sixteen
Posts: 11
Joined: Mon Jan 22, 2007 11:42 pm
Contact:

Post by three_sixteen »

I am not familiar enough with MSSQL to write a new query, I don't think -- I will poke around.

What I'll probably end up doing is using the generatetopten function to do something, since that works.
three_sixteen
Posts: 11
Joined: Mon Jan 22, 2007 11:42 pm
Contact:

Heres my work around..

Post by three_sixteen »

Code: Select all

require_once('../../inc/functions.php');
require_once('../../inc/init.php');

// connect to the database server, define the prefix and connect
require_once("../../inc/data.php");
require_once("../../inc/db.php");

define("SQLPREFIX", $DB["prefix"]);
$db = db::db_select($DB["type"]);

//connect to mssql
$db->connect($DB["server"], $DB["user"], $DB["password"], $DB["db"]);

$result = generateTopTenData('en', PMF_NUMBER_RECORDS_TOPTEN);

header("Content-Type: text/xml");

echo "<?xml version='1.0' encoding='utf-8'?>\n<rss version=\"2.0\">\n<channel>\n";
echo "<title>Insight Global Technical Support - Top 10 Questions</title>\n";
echo "<description>".htmlspecialchars($PMF_CONF["metaDescription"])."</description>\n";
echo "<link>".getSystemScheme().$_SERVER["HTTP_HOST"].str_replace ("/feed/topten/rss.php", "", $_SERVER["PHP_SELF"])."</link>";

if (count($result) > 0)
{
   foreach ($result as $row) 
   {  
      echo "\t<item>\n";
      //Post title - truncate if it's over 9 words.
      echo "\t\t<title><![CDATA[" . makeShorterText($row['thema'],8). " (" .$row['visits']." views)]]></title>\n";
      //echo "<item>".$row['visits']." ".$PMF_LANG["msgViews"].":</item>";
	   echo "\t\t<link>" . getSystemScheme() . $_SERVER["HTTP_HOST"] . $row['url'] . "</link>\n";
	   echo "\t</item>\n";
   }
} 
else
{
	echo $PMF_LANG["err_noTopTen"];
}

echo "</channel>\n</rss>";
I know it's probably messy.. but I couldn't think of any other way in my skillset to do it.

Any critiques?
three_sixteen
Posts: 11
Joined: Mon Jan 22, 2007 11:42 pm
Contact:

Post by three_sixteen »

Meh, this isn't working right...

The function is leaking somewhere and the MSSQL connection times out every so often when I try to generate the XML file.

:(
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
three_sixteen wrote:Meh, this isn't working right...

The function is leaking somewhere and the MSSQL connection times out every so often when I try to generate the XML file.
you've missed to drop here yor MS SQL Server version. I've just tested it with MSSQL 2005 EE using the Management Studio as previously suggested and this was the error message:

Code: Select all

Incorrect syntax near the keyword 'DISTINCT'.
this error prevents collecting any result set.

Remove the word 'DISTINCT' from your topten/rss.php and everything will work as expected ;). Fixed on 1.6.11.

Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
azism
Posts: 69
Joined: Mon Nov 28, 2005 9:51 pm
Location: Tucson, AZ USA
Contact:

Post by azism »

I removed the word DISTINCT from rss.php in the topten folder and tried it. I get a block, but in the block all I see is the title, a column of 10 dots and a link "Read More". However, I don't get any data.

Just to make sure I wasn't having a color contrast problem, I tried a copy of everything in the dialog box. Sure enough, there is only one space after each dot.

I'm open to suggestions or ideas. :?
Webmaster, TI99ers On-Line User Group
http://www.ti99ers.org
FAQ: http://www.ti99ers.org/phpmyfaq
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
azism wrote:I'm open to suggestions or ideas. :?
Are you using a Feed Reader or are you simply looking at the raw XML putting the RSS URL in your browser? Could you PM the TopTen RSS URL of yor faq server?

Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
azism
Posts: 69
Joined: Mon Nov 28, 2005 9:51 pm
Location: Tucson, AZ USA
Contact:

Post by azism »

Oh boy, you ask tough questions. :?

I am not sure. I just want something that will either display the top ten in a block or something that when clicked on in php-Nuke that will display the top ten. RSS and XML aren't something I understand. Sorry... :oops:
Webmaster, TI99ers On-Line User Group
http://www.ti99ers.org
FAQ: http://www.ti99ers.org/phpmyfaq
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
ok you're using a Feed Reader ;): even if you don't know nothing about XML, open your favorite browser, go to your PMF site and click on the RSS icon about TopTen. As you can see:
  1. the XML is human readable and understandable: give it a try ;);
  2. you'll find that the info exposed by the standard (i.e. without a bit of hack into the code) topten feed is not good to be added in an external block: no content data is provided, only the title;
  3. make the same with the Latest feed and you'll find that this feed can be used within an external block 'cause it has also the content data.
Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Post Reply