morenews

This is a discussion on morenews within the PHP Language forums, part of the PHP Programming Forums category; I try to use MoreNews 1.0 to get the latest headlines on my website. I really like the script (...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-16-2003
Inge Knudsen
 
Posts: n/a
Default morenews

I try to use MoreNews 1.0 to get the latest headlines on my website. I
really like the script (http://mberg.buildafrica.org/morenews/ can be
seen in action here: http://www.handystart.com/morenews/news.php )
published under GPL, but there is a bug that is really annoying me. When
there is a subscription site in the xml feed, the news-link below will
be like:
http://www.latimes.com/services/site...pl?x102503623&

....while it's supposed to be just:
http://c.moreover.com/click/here.pl?x102503623&

Has anyone done any work on this script, or is there a genuis that knows
how to correct it? I have tried to make some modefications, but just
can't make it right...

Inge

--
http://www.handystart.com/

Reply With Quote
  #2 (permalink)  
Old 11-16-2003
Janwillem Borleffs
 
Posts: n/a
Default Re: morenews


"Inge Knudsen" <antispam@eyepublish.com> schreef in bericht
news:09Qtb.39276$os2.575740@news2.e.nsc.no...
>
> Has anyone done any work on this script, or is there a genuis that knows
> how to correct it? I have tried to make some modefications, but just
> can't make it right...
>


I have had a quick look at it, and since it is reading the content from the
<url /> element and copying it directly in the output, I don't regard it as
a bug from the script but just as an alternative format of the URL in the
feed.

As far as I can see, you can just leave it as is, but when you really don't
want it, you could try the following workaround to fix the URL's:

Replace the characterData function in the class.morenews.php file with the
following:

function characterData($parser, $data) {
if ($this->tags[$this->cur_tag]) {
if ($this->cur_tag == "URL") {
$strpos = strpos($data, "http://c.moreover.com");
if ($strpos !== false) {
$this->cur_val .= ltrim(substr($data, $strpos));
} else {
$this->cur_val .= ltrim($data);
}
} else {
$this->cur_val .= ltrim($data);
}
}
}


HTH,
JW




Reply With Quote
  #3 (permalink)  
Old 11-17-2003
Inge Knudsen
 
Posts: n/a
Default Re: morenews

Janwillem Borleffs wrote:
>
> I have had a quick look at it, and since it is reading the content from the
> <url /> element and copying it directly in the output, I don't regard it as
> a bug from the script but just as an alternative format of the URL in the
> feed.


The problem is that it messes up the wrong link. If you click on 'Exxon
fined $11.8bn in gas row' here
(http://www.handystart.com/morenews/n...siness+stories)
now, you will be redirected to www.fortune.com....


> As far as I can see, you can just leave it as is, but when you really don't
> want it, you could try the following workaround to fix the URL's:
>
> Replace the characterData function in the class.morenews.php file with the
> following:
>
> function characterData($parser, $data) {
> if ($this->tags[$this->cur_tag]) {
> if ($this->cur_tag == "URL") {
> $strpos = strpos($data, "http://c.moreover.com");
> if ($strpos !== false) {
> $this->cur_val .= ltrim(substr($data, $strpos));
> } else {
> $this->cur_val .= ltrim($data);
> }
> } else {
> $this->cur_val .= ltrim($data);
> }
> }
> }
>
>
> HTH,


Sorry, still couldn't make it work...

Thanks,

Inge (is rather stupid when it comes to PHP)

--
http://www.handystart.com/

Reply With Quote
  #4 (permalink)  
Old 11-17-2003
Janwillem Borleffs
 
Posts: n/a
Default Re: morenews


"Inge Knudsen" <antispam@eyepublish.com> wrote in message
news:e80ub.39421$os2.577326@news2.e.nsc.no...
>
> Sorry, still couldn't make it work...
>
> Thanks,
>


Saw the problem, the fix is even easier:

In the class.morenews.php file, extend the $tags array to match the
additional elements:

$this->tags = array( "ARTICLE" => 1,
"URL" => 2,
"HEADLINE_TEXT" => 2,
"SOURCE" => 2,
"MEDIA_TYPE" => 2,
"DOCUMENT_URL" => 2,
"HARVEST_TIME" => 2,
"TAGLINE" =>2,
"CLUSTER" => 2,
"ACCESS_REGISTRATION" => 2,
"ACCESS_STATUS" => 2
);


JW



Reply With Quote
  #5 (permalink)  
Old 11-17-2003
Inge Knudsen
 
Posts: n/a
Default Re: morenews

Janwillem Borleffs wrote:

> "Inge Knudsen" <antispam@eyepublish.com> wrote in message
> news:e80ub.39421$os2.577326@news2.e.nsc.no...
>
>>Sorry, still couldn't make it work...
>>
>>Thanks,
>>

>
>
> Saw the problem, the fix is even easier:
>
> In the class.morenews.php file, extend the $tags array to match the
> additional elements:
>
> $this->tags = array( "ARTICLE" => 1,
> "URL" => 2,
> "HEADLINE_TEXT" => 2,
> "SOURCE" => 2,
> "MEDIA_TYPE" => 2,
> "DOCUMENT_URL" => 2,
> "HARVEST_TIME" => 2,
> "TAGLINE" =>2,
> "CLUSTER" => 2,
> "ACCESS_REGISTRATION" => 2,
> "ACCESS_STATUS" => 2
> );
>


Thanks, you're my hero :-) It now works perkect. I somehow tried
something like that, but must have missed a tag or two.

Thanks,

Inge

--
http://www.handystart.com/

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:56 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0