Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted August 23, 20195 yr Ever since the introduction of the SEO friendly pagination \IPS\Request::i()->page has been empty. In \IPS\cms\Databases\Dispatcher::run you extract this data, and adds it to the request object. You mind doing this for other pages too, not just pages that use the {database} template tag?
August 26, 20195 yr I'm not sure I'm following - I don't see anywhere in that method where we're pulling out pagination information. Do you have an example of a page not working or something that did in previous versions?
August 26, 20195 yr 52 minutes ago, bfarber said: Do you have an example of a page not working or something that did in previous versions?
August 26, 20195 yr Author 4 hours ago, bfarber said: I'm not sure I'm following - I don't see anywhere in that method where we're pulling out pagination information. 4 hours ago, bfarber said: Do you have an example of a page not working or something that did in previous versions? After SEO pagination was introduced, the pagination in the URL is considered a part of the SEO title in Pages. For a page titles "123test", the path in \IPS\Request::$_data is "123test/page/1". {{$featuredNewsRecordsClass = '\IPS\cms\Records1';}} {{$featuredNewsWhere = array( array( 'record_locked=?', 0 ) );}} {{$url = \IPS\Http\Url::internal( "app=cms&module=pages&controller=page&path=" . \IPS\cms\Pages\Page::$currentPage->full_path, 'front', 'content_page_path', \IPS\cms\Pages\Page::$currentPage->full_path );}} {{$count = 0;}} {{$page = isset( \IPS\Request::i()->page ) ? intval( \IPS\Request::i()->page ) : 1;}} {{$limit = 11 * ( $page - 1 );}} {{$articles = $featuredNewsRecordsClass::getItemsWithPermission( $featuredNewsWhere, 'record_featured DESC, record_publish_date DESC', array( $limit, 11 ), 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, TRUE, FALSE, FALSE, FALSE );}} {{$count = $featuredNewsRecordsClass::getItemsWithPermission( $featuredNewsWhere, 'record_featured DESC, record_publish_date DESC', array( $limit, 11 ), 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );}} {{$pagination = array( 'page' => $page, 'pages' => ( $count > 0 ) ? ceil( $count / 11 ) : 1 );}} {{if $page > $pagination['pages']}} {{\IPS\Output::i()->redirect( \IPS\Request::i()->url()->setQueryString( 'page', 1 ), NULL, 303 );}} {{endif}} It looks something like this. If I var_dump the request object I get this: [data:protected] => Array ( [app] => cms [module] => pages [controller] => page [path] => 123test/page/2 ) I copied the code in the screenshot above into a method in my app which I call before the page code in order to temporarily solve this.
Archived
This topic is now archived and is closed to further replies.