FeedForAll Forum Index  
 Home  •  FAQ  •   Search   •  Register   •  Profile   •  Log in
 How to Handle Duplicate Titles and/or URLs View next topic
View previous topic
Post new topicReply to topic
Author Message
Justin



Joined: 03 Jan 2007
Posts: 4

PostPosted: Wed Jan 03, 2007 9:34 am Reply with quoteBack to top

Hi and Happy New Year :)!

How can RSS2HTMLPro be used to display only one record if there are duplicate ItemTitles and/or ItemSourceURLs from the RSSmesh created feed?

On a good day, I might be able to pull off something like this with my limited knowledge of PERL, but, unfortunately, I am currently PHP stupid.

Thanks!

Justin =)
View user's profileVisit poster's website
MacSupport



Joined: 24 Feb 2005
Posts: 2805

PostPosted: Wed Jan 03, 2007 9:41 am Reply with quoteBack to top

Justin wrote:
Hi and Happy New Year :)!

How can RSS2HTMLPro be used to display only one record if there are duplicate ItemTitles and/or ItemSourceURLs from the RSSmesh created feed?

On a good day, I might be able to pull off something like this with my limited knowledge of PERL, but, unfortunately, I am currently PHP stupid.

Thanks!

Justin =)


I am sure it can be done, but I will have to think about that some.

Jim

_________________
Be sure to check out the FeedForAll Mac tutorials at: http://www.FeedForAll.com/tutorials/

FeedForAll Mac and rss2html.php
support@FeedForAll.com
View user's profileVisit poster's website
Justin



Joined: 03 Jan 2007
Posts: 4

PostPosted: Wed Jan 03, 2007 9:50 am Reply with quoteBack to top

MacSupport wrote:
I am sure it can be done, but I will have to think about that some.

Okey doke. Thanks for the prompt reply. Looking forward to a possible solution.

Justin =)
View user's profileVisit poster's website
MacSupport



Joined: 24 Feb 2005
Posts: 2805

PostPosted: Wed Jan 03, 2007 3:15 pm Reply with quoteBack to top

Justin wrote:
MacSupport wrote:
I am sure it can be done, but I will have to think about that some.

Okey doke. Thanks for the prompt reply. Looking forward to a possible solution.

Justin =)


This should do it for you, will check both title and link

Code:

<?php
$titleArray = Array();
$linkArray = Array();
?>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>~~~FeedTitle~~~</title>
  </head>
  <body>
    <h1>~~~FeedTitle~~~</h1>
    <p>~~~FeedDescription~~~</p>
    <hr>
    <table width="100%">
      ~~~BeginItemsRecord~~~
<?php
$okayToDisplay = 1;

//
// Add the current item title and link to the arrays
$titleArray[] = "~~~ItemTitle~~~";
$linkArray[] = "~~~ItemLink~~~";

for ($x = 0; $x < count($titleArray)-1; $x++) {
  //
  // Look to see if there were previously used.
  if (("~~~ItemTitle~~~" == $titleArray[$x]) || ("~~~ItemLink~~~" == $linkArray[$x])) {
    $okayToDisplay = 0;
    break;
  }
}

if ($okayToDisplay == 1) {
?>
      <tr><td>~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~</td></tr>
      <tr><td>~~~ItemTitle~~~</td></tr>
      <tr><td>~~~ItemDescription~~~</td></tr>
      <tr><td><hr></td></tr>
<?php
}
?>
      ~~~EndItemsRecord~~~
    </table>
  </body>
</html>


Jim

_________________
Be sure to check out the FeedForAll Mac tutorials at: http://www.FeedForAll.com/tutorials/

FeedForAll Mac and rss2html.php
support@FeedForAll.com
View user's profileVisit poster's website
Justin



Joined: 03 Jan 2007
Posts: 4

PostPosted: Wed Jan 03, 2007 4:45 pm Reply with quoteBack to top

Looks very graceful. Thanks so much, Jim!

Couple more quick questions, if you don't mind:

In PHP, does the double-pipe (the "||" in the first "if" condition) signify an AND or an OR operation? Or something else? Right now, I only need one, and not both title and url, to match. I guess I could just replace the double-pipe with the "or" syntax? Or an "and" if I later do need both?

Also, are the title compares case insensitive? If not, how would I do that?

Thanks again!

Justin =)
View user's profileVisit poster's website
MacSupport



Joined: 24 Feb 2005
Posts: 2805

PostPosted: Wed Jan 03, 2007 4:56 pm Reply with quoteBack to top

Justin wrote:
Looks very graceful. Thanks so much, Jim!

Couple more quick questions, if you don't mind:

In PHP, does the double-pipe (the "||" in the first "if" condition) signify an AND or an OR operation? Or something else? Right now, I only need one, and not both title and url, to match. I guess I could just replace the double-pipe with the "or" syntax? Or an "and" if I later do need both?

Also, are the title compares case insensitive? If not, how would I do that?

Thanks again!

Justin =)


Like C

|| = logical or
&& = logical and

For just title use
Code:

if ("~~~ItemTitle~~~" == $titleArray[$x]) {


The compare is an exact compare, include spacing and case. To do case insensitive comare
Code:

if (strcasecmp("~~~ItemTitle~~~", $titleArray[$x]) == 0) {


Jim

_________________
Be sure to check out the FeedForAll Mac tutorials at: http://www.FeedForAll.com/tutorials/

FeedForAll Mac and rss2html.php
support@FeedForAll.com
View user's profileVisit poster's website
Justin



Joined: 03 Jan 2007
Posts: 4

PostPosted: Wed Jan 03, 2007 5:18 pm Reply with quoteBack to top

Great. So using "||" will match and not display succeeding records with either a title or url match (which is what I want) and I can change it to "&&" later if I want to filter out records that have both title and url matches?

Thanks for the "strcasecmp" syntax for case insensitive.

Justin =)
View user's profileVisit poster's website
MacSupport



Joined: 24 Feb 2005
Posts: 2805

PostPosted: Wed Jan 03, 2007 5:25 pm Reply with quoteBack to top

Justin wrote:
Great. So using "||" will match and not display succeeding records with either a title or url match (which is what I want) and I can change it to "&&" later if I want to filter out records that have both title and url matches?

Thanks for the "strcasecmp" syntax for case insensitive.

Justin =)


You are welcome

Jim

_________________
Be sure to check out the FeedForAll Mac tutorials at: http://www.FeedForAll.com/tutorials/

FeedForAll Mac and rss2html.php
support@FeedForAll.com
View user's profileVisit poster's website
mkp



Joined: 01 Sep 2010
Posts: 6

PostPosted: Tue Nov 02, 2010 12:17 pm Reply with quoteBack to top

I would like to point out that Macsupport has been doing a really wonderful job through this blog. I am an IT student and I am a regular reader of this blog. Needless to say I have learned a lot through it. Right now I am taught about RSS2HTMLPro in the class. But I have learned more about it through this blog rather than from the class. I would like to specifically thank Macsupport for sharing his knowledge with us.
View user's profile
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme