Jump to content


[Snippet] RSS FEED


32 replies to this topic

#16 Cris D.

    Loves Etomite Forums!

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

Posted 24 February 2008 - 09:25 PM

Once you start looking at streaming content you open up a whole new array of potential problems,(buffering, timeouts etc). Yes it could be done but if the current code works with it it would be lucky.

#17 cathode

    Loves Etomite Forums!

  • Staff
  • 648 posts
  • Gender:Male

Posted 26 February 2008 - 11:54 PM

Cris,
I've set up this snippet and it works great, but I have some questions:

1) Is there a right way of disabling the etoNotice? I'm not finding this switch in the index file... Also wouldn't it be nice not to have to do this? I'd like to keep the notice but not have it show up in the feed...
2) how can I call this snippet dynamically (if possible) so that a feed of the page it's clicked on is available? Let me elaborate: I'm on the news page, I click the RSS link, and I get a feed of the news page. I'm on the home page, I click the RSS link, and I get a feed of the home page.

Also, can I use a parent of '0' to get a feed of the whole website?
thanks :) Great work as usual.

#18 Cris D.

    Loves Etomite Forums!

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

Posted 27 February 2008 - 04:59 AM

Quote

I'm on the news page, I click the RSS link, and I get a feed of the news page. I'm on the home page, I click the RSS link, and I get a feed of the home page.
That's a good Idea, I'll have a look at the code and see what I can do, I never thought of that but it is an obvious use...

No you can't set 0 to do the whole site. You can, however use phpMyAdmin to add 'rss' to every page in the keyword table, this will add every page in the site.

Eto notice needs to be manually removed by deleting it from the bottom of the snippet. I thought that seeing I was asking everyone to remove the notice from thier site for the feed to validate, that they should have it somewhere and made it tricky for people to remove it to compensate.

I'll get back to you about possibilities for adding a dynamic rss feed link to embed in a template.

[edit] the etoNotice=false; switch is almost at the bottom of the index.php file, if it still exists, you will get an error with the feed. If you have already removed it as mentioned above and you are seeing it in the feed, you will have to remove it from the snippet code.[/edit]

Edited by Cris D., 27 February 2008 - 07:38 AM.


#19 Cris D.

    Loves Etomite Forums!

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

Posted 27 February 2008 - 08:14 AM

OK, I can adapt the snippet to create a link for the page being viewed as a single page, however, it will mean a new snippet. There are too many checks and balances in the existing RSS2.2 snippet to add this feature easily. It would be much easier to re-code it as a stand-alone RSSThisPage snippet. So this brings us to how badly do you need this feature? I'm pretty bogged down in my current project unless someone else want to do it:
  • remove all checks for input types and just use a $_POST['rssId'];
  • configure the new snippet to return the results of the posting page only,
  • code the data so only the posting page data is shown($data=$etomite->getDocumentContent($_POST['rssId']);)
  • create a new document for just the RSSThisPage snippet
  • create a form that posts the $etomite->documentIdentifier id to the snippet to place in the site template,
  • test to see how the 2 rss snippets will interact if in the same site
  • document setting up procedures for the RSSThisPage snippet
  • Post to etomite library.

Any takers? Otherwise as much as I love supporting my snippets, it won't be until nearing the end of this year...

#20 Cris D.

    Loves Etomite Forums!

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

Posted 28 February 2008 - 11:41 AM

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.

#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,506 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,506 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,506 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