Jump to content


[Snippet] RSS FEED


  • You cannot reply to this topic
32 replies to this topic

#21 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 28 February 2008 - 02:05 PM

View PostCris D., on Feb 28 2008, 06:41 AM, said:

Strike that last comment from the record your honour... In my defence, I was tired, cranky and stressed. I wrote the rssThisPage snippet and i'm the process of posting it to the snippet library... enjoy.

Wow, you're good... :D

#22 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 28 February 2008 - 02:39 PM

How time flies, Cris... That was a quick year... We all know how it can be to find time to patch up code... Ummm... :huh: Did I say that...??? :rolleyes:

#23 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 04 December 2008 - 12:46 AM

Hi,
i am using etomite for a little while now, and wanted to make an rss feed available, however i have some problems getting it right.
The feed i have is almost correct ( http://www.pernette.nl/rssFeed )

But somehow in the source just after the <channel> tag there is a <p> tag inserted.
And this <p> tag makes the complete RSS feed unvalid.

Does anyone have an idea where this <p> tag might be coming from? a have been looking a little at the snippet and the template, but it doesn't look like there is anything wrong.

MoRRiS

#24 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 04 December 2008 - 01:04 AM

ok, i found the error.
The rssFeed page itself which has as only content [!rssFeed2.0!] or should i say 'should have' was wrong.
Because i do all my edits with the rich text editor, the text editor inserted a <p>.. </p> in the page.

If i tried to switch to htmlsource, then delete the <p> and click update it looked like it removed the <p> tags, but whenever i then hit the 'save' button it inserted the <p> tags again.

the solution was to switch in the etomite settings the editor to simple html editing, fix or create this page, and save it.
afterwards you can switch back to rich text editor again.

keep up the good work with this nice RSS feed sippet!!

MoRRiS

Edited by MoRRiS, 04 December 2008 - 10:25 AM.


#25 Jelmer

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,173 posts

Posted 04 December 2008 - 06:58 AM

Another solution would have been to disable Rich Text Editing only for this specific document. Glad you got it sorted!

#26 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 11 December 2008 - 10:50 PM

Hi,
I am having problems again running the rss snippet, and i think i pinned it down to the following query that made:
$sql = "SELECT * FROM $tbl1 WHERE keyword='RSS' OR keyword='rss' UNION SELECT * FROM $tbl2 WHERE keyword_id > 0";

the results are always to much pages even if there is no page that has the 'rss' keywoard.
If i run this query on my database, this is the result

mysql> select * from etomite_site_keywords where keyword='RSS' or keyword='rss' UNION select * from etomite_keyword_xref where keyword_id > 0;
+-----+---------+
| id | keyword |
+-----+---------+
| 8 | rss |
| 66 | 49 |
| 66 | 47 |
| 65 | 53 |
| 160 | 3 |
| 160 | 12 |
| 161 | 50 |
| 169 | 52 |
| 169 | 51 |
| 162 | 9 |
| 168 | 9 |
| 108 | 8 |
| 51 | 3 |
| 52 | 2 |
| 55 | 5 |
| 58 | 4 |
| 60 | 6 |
| 61 | 7 |
+-----+---------+
18 rows in set (0.00 sec)



And i think the only result should be that page_id 108 has keyword '8' (keywoard 8 being 'rss')

Can anyone help me with this, what is going wrong in my setup?

MoRRiS

#27 Cris D.

    Loves Etomite Forums!

  • Developers
  • PipPipPipPip
  • 1,104 posts
  • Gender:Male

Posted 12 December 2008 - 09:14 AM

The easiest way to work around this problem (I can't diagnose what is wrong with a UNION statemetn not working), is to use the other method of adding RSS pages by adding them to the internal array of page id's in the snippet config instead of relying on the internal dbQuery.

#28 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 12 December 2008 - 11:40 AM

A considerable time ago I wrote some code with complex SQL queries in it and it didn't work correctly. I spent some time stripping down the queries to basics and found that some versions of MySQL did not handle complex queries correctly, no matter how carefully you ensured the operator precedence was right.

Its too long ago for me to remember the details, or which versions of MySQL I was using at the time, but you may have to break down the query into several simpler queries returning partial results.

#29 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 12 December 2008 - 01:51 PM

mikef is correct... And, worse yet, some queries won't even throw an error... Instead, they simply ignore the parts it can't process and return inaccurate results... Knowing your MySQL releae number would be of great help in resolving this issue...

#30 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 13 December 2008 - 11:56 AM

View PostRalph, on Dec 12 2008, 02:51 PM, said:

mikef is correct... And, worse yet, some queries won't even throw an error... Instead, they simply ignore the parts it can't process and return inaccurate results... Knowing your MySQL releae number would be of great help in resolving this issue...

Hi, with some help of a friend, i think i created a query that does work now, if i am sure it works i will upload it later. (should i upload the complete snippet's code, or just the changes i made?)
The mysql version i use is 5.032 (debian installation)

MoRRiS.

#31 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 13 December 2008 - 02:27 PM

View PostMoRRiS, on Dec 13 2008, 06:56 AM, said:

Hi, with some help of a friend, i think i created a query that does work now, if i am sure it works i will upload it later. (should i upload the complete snippet's code, or just the changes i made?)
The mysql version i use is 5.032 (debian installation)

MoRRiS.

Great... If the code works and all you've changed is the query itself, posting the new query code should suffice... Either way is fine, however - especially if you'd like credit for the potential improvement...

#32 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 13 December 2008 - 02:29 PM

View PostRalph, on Dec 13 2008, 03:27 PM, said:

Great... If the code works and all you've changed is the query itself, posting the new query code should suffice... Either way is fine, however - especially if you'd like credit for the potential improvement...


Only changing the query wasn't enough. since the script started with the UNION parameter further on in the script the wrong column names where used. the best way would be to clean up the complete snippet, but right now we just swapped the colomn names wich is a little dirty :)

#33 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 13 December 2008 - 02:44 PM

ok, the code changes so far.
change the existing query:
 $sql = "SELECT * FROM $tbl1 WHERE keyword='RSS' OR keyword='rss' UNION SELECT * FROM $tbl2 WHERE keyword_id > 0";
	  
	   $resourceArray=array();
	   $result = $this->dbQuery($sql);
	   for($i=0;$i<@$this->recordCount($result);$i++)  {
	   
		 array_push($resourceArray,@$this->fetchRow($result));
	   
	   }
	  
	  //extract the document ids, pop the ist field off with keyword results
	   for($i=1; $i<count($resourceArray); $i++){
		  $RSSDocs[]=$resourceArray[$i]['id'];
	   }
into:
 $sql = "SELECT * FROM $tbl1 WHERE keyword='RSS' OR keyword='rss'";
 $result = $this->dbQuery($sql);
 for($i=0;$i<@$this->recordCount($result);$i++)  {
	$row = $this->fetchRow($result);
	$rss_ids.= ','.$row['id'];
 }
 
 
 $sql = "SELECT content_id AS id FROM $tbl2 WHERE keyword_id IN (0".$rss_ids.")";
	  
	   $resourceArray=array();
	   $result = $this->dbQuery($sql);
   //	echo 'aantal results uit query: '.$this->recordCount($result);
	   for($i=0;$i<@$this->recordCount($result);$i++)  {
		   
		 array_push($resourceArray,@$this->fetchRow($result));
	   
	   }
	  
	  //extract the document ids, pop the ist field off with keyword results
	   for($i=0; $i<count($resourceArray); $i++){
		  $RSSDocs[]=$resourceArray[$i]['id'];
	  //	echo 'ID: '.$resourceArray[$i]['id'].'
 ';
	   }

So far, this is what i changed to make it work. I hope it will help people :)

(hmm, the debugging comments may be deleted :) )

Edited by MoRRiS, 13 December 2008 - 02:45 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users