Author |
Message |
Justin
Joined: 03 Jan 2007
Posts: 4
|
Posted: Wed Jan 03, 2007 9:34 am |

|
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 =)
|
|
|

|
 |
MacSupport
Joined: 24 Feb 2005
Posts: 2805
|
Posted: Wed Jan 03, 2007 9:41 am |

|
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
|
|

|
 |
Justin
Joined: 03 Jan 2007
Posts: 4
|
Posted: Wed Jan 03, 2007 9:50 am |

|
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 =)
|
|
|

|
 |
MacSupport
Joined: 24 Feb 2005
Posts: 2805
|
Posted: Wed Jan 03, 2007 3:15 pm |

|
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: |
$titleArray = Array();
$linkArray = Array();
?>
?
? ?
? ? ~~~FeedTitle~~~
?
?
? ? ~~~FeedTitle~~~
? ? ~~~FeedDescription~~~
? ?
? ?
? ? ? ~~~BeginItemsRecord~~~
$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) {
?>
? ? ? ~~~ItemPubShortDate~~~ ~~~ItemPubShortTime~~~ |
? ? ? ~~~ItemTitle~~~ |
? ? ? ~~~ItemDescription~~~ |
? ? ?
|
}
?>
? ? ? ~~~EndItemsRecord~~~
? ?
?
|
Jim
|
_________________
Be sure to check out the FeedForAll Mac tutorials at: http://www.FeedForAll.com/tutorials/
FeedForAll Mac and rss2html.php
|
|

|
 |
Justin
Joined: 03 Jan 2007
Posts: 4
|
Posted: Wed Jan 03, 2007 4:45 pm |

|
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 =)
|
|
|

|
 |
MacSupport
Joined: 24 Feb 2005
Posts: 2805
|
Posted: Wed Jan 03, 2007 4:56 pm |

|
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
|
|

|
 |
Justin
Joined: 03 Jan 2007
Posts: 4
|
Posted: Wed Jan 03, 2007 5:18 pm |

|
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 =)
|
|
|

|
 |
MacSupport
Joined: 24 Feb 2005
Posts: 2805
|
Posted: Wed Jan 03, 2007 5:25 pm |

|
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
|
|

|
 |
mkp
Joined: 01 Sep 2010
Posts: 6
|
Posted: Tue Nov 02, 2010 12:17 pm |

|
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.
|
|
|
 |
 |
|