[FIXED] Page system (Pager) issue on first page

[FIXED] Page system (Pager) issue on first page

Postby easyexpat on Thu Aug 14, 2014 6:43 pm

Hello,

I run lifetype-1.2.12_r7211
On the home page of the page, all the pages except the first send the message:
Error

The articles could not be fetched.

Back

It means that blog1.domain.com works but blog1.domain.com/page/2 does not.
However it works when using blog1.domain.com/?page=2

I have no problem with the categories where blog1.domain.com/blog/category and blog1.domain.com/blog/category/page/2 both work.

I have spent a long time trying to figure out where the problem comes from, is there is a bug somewhere. I searched into class\action\blogaction.class.php and in class\action\defaultaction.class.php but I cannot figure out what's wrong.
I don't even know where to look for to see where there might be a problem. :cry:
It seems that the error message is thrown here with setValidationErrorView:
Code: Select all
function DefaultAction( $actionInfo, $request )
        {
         $this->BlogAction( $actionInfo, $request );

         $this->registerFieldValidator( "searchTerms", new StringValidator( true ), true );
         $this->registerFieldValidator( "postCategoryId", new IntegerValidator(), true );
         $this->registerFieldValidator( "postCategoryName", new StringValidator( ), true );
         $this->registerFieldValidator( "userId", new IntegerValidator(), true );
         $this->registerFieldValidator( "userName", new UsernameValidator(), true );

         $this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_fetching_articles" ));
        }


NB: in admin, if I put page_suffix_format=?page={page} instead of /page/{page} it works for the home of the blog and following pages but then I have the error when I look for a specific category! :cry: :cry:

Any idea is more than welcome as I am a bit desperate ... :(
Last edited by easyexpat on Fri Aug 15, 2014 8:26 am, edited 1 time in total.
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: Page system (Pager) issue on first page

Postby easyexpat on Fri Aug 15, 2014 8:24 am

I think I found a fix.
It seems to be a issue in the file class/net/customurlhandler.class.php
EDIT (inside function process( $requestUri ))
Code: Select all
// if it didn't work out the first time, let's try with an additional url format
         if( !$this->_fillRequestParameters()) {
            $m = new LinkFormatMatcher( $requestUri, $this->_fallback );
            $this->_format = $m->identify();
            $this->_params = $m->getParameters();
            if(!$this->_fillRequestParameters())
                    return false;
         }

REPLACE
Code: Select all
// if it didn't work out the first time, let's try with an additional url format
         if( !$this->_fillRequestParameters()) {
            $m = new LinkFormatMatcher( $requestUri, $this->_fallback );
            $this->_format = $m->identify();
            $this->_params = $m->getParameters();
            /*if(!$this->_fillRequestParameters())
                    return false;*/
         }

In case we have no parameter other than PAGE (which is the case for blog1.domain.com/page/2) it goes inside that function to get the parameters. But anyway, as there is still no parameter other than page which has been stripped off earlier, it returns FALSE! :shock:

Therefore in /blog.php of course it returns an error and goes into:
Code: Select all
// Hack to force an error page in defaultaction
    if(!$error){
      $vars["userId"] = "userId";
      $params["userId"] = "INVALID";
    }


which means that it cannot find any article...

For me that hack solved the issue. :ugeek:
Last edited by easyexpat on Fri Aug 22, 2014 4:52 am, edited 1 time in total.
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: [FIXED] Page system (Pager) issue on first page

Postby jondaley on Thu Aug 21, 2014 2:06 pm

I feel like I have fixed this bug many times.

But, I checked my own blog, and it was broken again. My mother-in-law has reported the bug a number of times, and so I verified that her blog was still working. I copied the setting to my own blog, and it is working again. There must be some other reason that my blog was set differently, but I don't remember.

Here is how I fixed it:
In Administration->General Settings->URLs
Set blog_link_format to: /?$

My blog is installed in the /plog directory, and I only have one blog in this installation, so I don't need the /blog/{blogname} part in the URL. For me, the ? was the key part. The page URL is set to /page/{page} and so unless I would use http://jon.limedaley.com//page/2, (note the double slash) the URL parsing would fail. But, if we make the slash optional (by adding the ?) then when generating the URLs it will do the right thing, but when parsing a URL without any other parameters, it can still be parsed correctly.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: [FIXED] Page system (Pager) issue on first page

Postby easyexpat on Fri Aug 22, 2014 5:31 am

jondaley wrote:Here is how I fixed it:
In Administration->General Settings->URLs
Set blog_link_format to: /?$

I have the same configuration for URLs (installation with subdomain for each blog).
It's frustrating to think that I spent hours to see where was the problem and fix it when ... adding a "?" in admin panel would have solved it immediately :ugeek: :D
NB: I haven't undone my hack yet, but I don't think it maters too much. The most important is to get it fixed one way or another ;-)

PS: Happy to see you back on the forums, jondaley. I thought that after the latest version you were not going to have time for much support anymore and unfortunately Lifetype is complex and help is appreciated :-)
easyexpat
 
Posts: 136
Joined: Mon Jun 13, 2005 4:39 pm

Re: [FIXED] Page system (Pager) issue on first page

Postby jondaley on Tue Aug 26, 2014 12:07 am

I am definitely available for support - just not time for coding. I wish I could get the forums to email me when there are posts - I don't think to check it all the time...
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Other Problems

cron