RSS self reference does not match document location

Report issues with Enuuk Auction Platform or Mods here - remember to raise a ticket with phpauction.net as well
Post Reply
bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

RSS self reference does not match document location

Post by bamse » Sun Aug 11, 2013 9:51 pm

When validating the RSS feeds with http://validator.w3.org/feed/, I receive the error:
Self reference doesn't match document location
for all feeds except for the home page feeds.

I believe this is due to class/View/Rss.php and the line:

Code: Select all

$data['atomLink'] = $this->context->siteOptions['protocol'].'://'.$this->context->HTTPHost.$this->context->relativePath.'?v=rss'.
($this->context->parameters['feed'] ? '&feed='.$this->context->parameters['feed'] : '').
($this->context->parameters['lang'] ? '&lang='.$this->context->parameters['lang'] : '');
Should

Code: Select all

$this->context->relativePath
be replaced with something else?

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: RSS self reference does not match document location

Post by RWAP » Mon Aug 12, 2013 8:02 am

Actually, I think that this is a bug - my own class\View\Rss.php starts:

Code: Select all

    public function display()
    {
        $data = $this->context->toArray();
        $data['lang'] = $this->context->language;
        $par=$this->context->parameters;
        $showView = true;
        if ($data['template']=='category.php'){
            $path='';
            foreach ($par as $k=>$v){
            	if (is_numeric($k)) $path.='/'.$v;
            }
        }
        $data['atomLink'] = $siteOptions['protocol'].'://'.$this->context->HTTPHost.$this->context->relativePath.
        					($data['template']=='category.php' ? 'category'.$path : '').
        					'?v=rss'.
                            ($par['feed'] ? '&feed='.$par['feed'] : '').
                            ($par['lang'] ? '&lang='.$par['lang'] : '');
This ensures that the atomLink points to the correct page - in standard Enuuk, it always points to the home page....

bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

Re: RSS self reference does not match document location

Post by bamse » Mon Aug 12, 2013 11:40 pm

This seems to fix the category feeds, but you'd still have the problem with the search feed.

RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Re: RSS self reference does not match document location

Post by RWAP » Tue Aug 13, 2013 1:03 pm

OK (I had forgotten about the RSS feed for searches) try the following:

Code: Select all

    public function display()
    {
        $par=$this->context->parameters;

        $data = $this->context->toArray();
        $data['lang'] = $this->context->language;
        $showView = true;
        $extra='';
        if ($data['template']=='category.php'){
            $path='';
            foreach ($par as $k=>$v){
            	if (is_numeric($k)) $path.='/'.$v;
            }
        } elseif ($data['template']=='search.php'){
            foreach ($par as $k=>$v){
            	$extrapars[]=$k.'='.str_replace(' ','%20',$v);
            }
            $extra='search?'.implode('&',$extrapars);

        }
        $data['atomLink'] = $this->context->siteOptions['protocol'].'://'.$this->context->HTTPHost.$this->context->relativePath.
        					($data['template']=='category.php' ? 'category'.$path : '').
        					($extra? $extra : '?v=rss'.
                            ($par['feed'] ? '&feed='.$par['feed'] : '').
                            ($par['lang'] ? '&lang='.$par['lang'] : ''));

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest