Pagination and sorting in a hosted environment not working

Hi guys,

I have deployed my code at GoDaddy, and I am experiencing problems. I have spent a couple of hours now trying to debug why both pagination and sorting has stopped working. This is working in my development environment of course.

Pretty much stuck here so far, wondering if this might be an Mysql versioning problem or something.

If anyone has a clue or suggestion, I would be happy to hear it :slight_smile:

Thanks guys,

OM

Are you using Linux servers or Windows servers on your godaddy account?

Hi,

we are using Linux.

OM

After some debugging what I now see is that I cannot get/use GET parameters from my Yii code. But deploying a php file and echoing the get parameter, it works. This is pretty weird.

Any suggestions?

OM

can you post the view you are using to display the data. Are you using a widget i.e. grid or list? if so, check in your browser if you have the script section created at the bottom and the generated assets folder in the header section - might be blocked permissions to create new folders for the on-the-fly assets folders.

Thanks for your response again,

the assets get generated as expected.So no permissions problem.

I found out that by for ex. changing a ? for get parameters to /, it works. Why is this so, and is there a way to fix this?

OM

Hi OM,

I have the same problem.

My pagination and sorting does not work, as the CListView is giving me e.g.


?sort=title

but if I manually change this in the address field to


/sort/title

it is working.

Of course, this could be solved by changing the yii widget (CListView), but that seams like a very bad solution.

Also, changing to an AJAX functionality on the sorting can help (I guess, without checking into the details), but that only fixes the sorting / pagination issues and not the other (very much needed) GET parameters I have.

Thanks for the help!

if you have your url manager configured (in main.php) then you should be able to use both, and the server (i.e. apache) will make the alias change. However, this goes together with your .htaccess set in you app’s root.

Option 1: you forgot to ftp the .htaccess file to the server

Option 2: your godaddy server configuration has url management already configured and its conflicting with your setting (that would explain the example you mentioned above)

Option 3: godaddy are limiting your .htaccess override permissions, its known that they do that for Windows hosting, but you are on linux so that shouldn’t happen.

I would comment out the urlManager component from the config and see if that fixes the issues and work from there.

Hi eclectus,

  1. The .htaccess is on the server.

  2. I will verify the url management by the hosting provider, but I really believe that this is not an issue.

  3. I am able to override the rewrite settings, otherwise I would not be able to have /controller/action, would I?

I tried to comment out the RewriteEngine = On in my .htaccess and then the /controller/action path did not work, so I presume this is working correctly.

Dagfinn, all these functions - pagination/sort by default call the controller’s createUrl method with the page information. You can override this method in your controller to support the URL scheme you want.

OK, thanks for the info. I can try to play around a bit with that.

As an FYI, I also found this entry in the yii guide: http://www.yiiframework.com/doc/guide/1.1/en/topics.url#c4781

which basically solves my problem, except for it is creating a quite bad URL. As an example:

I had this working in my dev environment:


/controller/action?sort=title

After the .htaccess change according to the entry above in the URL I get this:


/controller/action?controller%2Faction=&sort=title

Which is not too good I would say.

By reading up on Rewrite conditions I could make this better I guess.

This is the .htaccess I have:




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(index\.php)

RewriteRule ^(.+)$ index.php?$1 [PT,L,QSA]



Any tips on making this nice is very much appreciated. And thanks again for your great feedback, eclectus :slight_smile: