Yii Framework Forum: Yii 1.1.11 enableHistory with SEO-friendly URLs breaks pagination - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii 1.1.11 enableHistory with SEO-friendly URLs breaks pagination Rate Topic: -----

#1 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 14 August 2012 - 03:17 AM

enableHistory works great with with using default ?r=controller/action, however with urlManager configured as this:

 'urlManager' => array(
        	'urlFormat' => 'path',
        	'showScriptName' => false,
    	),


Pagination does not work anymore. Filtering, including history, works as expected on Page 1. But visiting another page breaks filters, and you stay on Page 1.

When selecting a new page in CGridView, the URL is updated to:
http://localhost/GridviewHistory/site/admin/?/GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin/Content_page/5//ajax/content-grid/Content_page/6//ajax/content-grid/Content_page/8//ajax/content-grid/Content_page/9//ajax/content-grid/Content_page/10//ajax/content-grid/Content_page/3//ajax/content-grid/Content_page/4//Content[name]//ajax/content-grid/Content_page/7=

But the page does not change. Note the questionmark in the URL which seems out of place.

Server: Apache (WAMP) on Windows 7
PHP version: 5.3.8
Browser: Firefox 14.01
Yii: 1.1.11

This post has been edited by ChessSpider: 14 August 2012 - 03:25 AM

0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,648
  • Joined: 17-January 09
  • Location:Russia

Posted 15 August 2012 - 04:52 AM

Please try with https://github.com/y.../zipball/master
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 15 August 2012 - 05:27 AM

Still there.

selecting multiple pages without applying filter results in url

http://localhost/GridviewHistory/site/admin/?/GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin//GridviewHistory/site/admin/Content_page/4//ajax/content-grid/Content_page/6//ajax/content-grid/Content_page/10//ajax/content-grid/Content_page/8//ajax/content-grid/Content_page/6//ajax/content-grid/Content_page/4//ajax/content-grid/Content_page/2//ajax/content-grid/Content_page/5//ajax/content-grid/Content_page/6//ajax/content-grid/Content_page/8=

This post has been edited by ChessSpider: 15 August 2012 - 05:28 AM

0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,648
  • Joined: 17-January 09
  • Location:Russia

Posted 15 August 2012 - 06:49 AM

Do you have standard rules?

'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 15 August 2012 - 06:55 AM

No, the urlManager is configured exactly as in the first post.

Gridview is also pretty much default:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
	'id' => 'content-grid',
	'dataProvider' => $model->search(),
	'enableHistory' => true,
	'filter' => $model,
	'columns' => array(
    	'name',
    	array(
        	'name' => 'published',
        	'value' => '($data->published == 0) ? Yii::t(\'app\', \'No\') : Yii::t(\'app\', \'Yes\')',
        	'filter' => array('0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')),
    	),
    	array(
        	'class' => 'CButtonColumn',
        	'template' => '{delete}',
    	),
	),
));
?>

This post has been edited by ChessSpider: 15 August 2012 - 06:58 AM

0

#6 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,648
  • Joined: 17-January 09
  • Location:Russia

Posted 15 August 2012 - 07:00 AM

Add default rules and it should help.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#7 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 15 August 2012 - 07:21 AM

I'd rather not.

I want to implement this in an existing application and I cannot gaurentee every URL has been created with the createURL function. If I change the routes, I may break parts of the application.

Why doesn't the pagination respect the rules?
0

#8 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,648
  • Joined: 17-January 09
  • Location:Russia

Posted 15 August 2012 - 08:17 AM

It does respect rules. The problem that rules are telling it to append parameters instead of replacing them.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#9 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 15 August 2012 - 08:33 AM

Can you suggest a work-around or something to resolve this? Or the bare minimum of rules to add?
0

#10 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,648
  • Joined: 17-January 09
  • Location:Russia

Posted 15 August 2012 - 09:12 AM

I've already did http://www.yiiframew...post__p__166574
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#11 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 16 August 2012 - 12:59 AM

If that is the bare minimum of rules to add to make this work I will try it. Thank you for your time :)

I do think this should be reflected in the documentation somewhere.
0

#12 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 17 August 2012 - 03:57 AM

Adding the rules does not work!

I use the gridview in a module, a module which is two levels deep. Same error. Adding the rules only fixes it for use outside of the module.

I'll file a bug report, functionality provided by a framework should "just" work. And if it doesn't, it should be clearly described in the documentation.


https://github.com/y...yii/issues/1246

This post has been edited by ChessSpider: 17 August 2012 - 04:07 AM

0

#13 User is offline   ChessSpider 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 20-July 11
  • Location:Netherlands

Posted 05 December 2012 - 05:34 AM

This bug has been fixed as of version 1.1.13, release candiate:

1246Bug #1584: Fixed CGridView and CListView urls when enableHistory was used with "path" urlFormat (mdomba)

https://github.com/y...yii/issues/1584

Thanks mdomba! Note issue 1246 should also be closed - https://github.com/y...yii/issues/1246
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users