Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
sobrenome Posted December 2, 2020 Posted December 2, 2020 On a record view template of a database (brand database), I want to show records from another database that are related (products from the brand). The custom code: {{$baseUrl = $record->url( "getPrefComment" );}} {{$limit=20;}} {{$page = (isset( \IPS\Request::i()->page ) and (intval( \IPS\Request::i()->page ) > 0)) ? \IPS\Request::i()->page : 1;}} {{$start = ( $limit * ( $page - 1 ) );}} {{$total = \IPS\Db::i()->select( 'COUNT(*)', 'cms_custom_database_8', array( 'field_140=?', $record->primary_id_field ) )->first();}} {{$select = \IPS\Db::i()->select( 'cms_custom_database_8.field_68 as nome_do_suplemento, cms_custom_database_8.record_image_thumb as imagem, cms_custom_database_8.primary_id_field as id_do_suplementos, cms_custom_database_8.member_id as autor, cms_custom_database_8.record_updated as data_de_atualizacao, cms_custom_database_8.record_comments as numero_de_comentarios', 'cms_custom_database_8', array( 'field_140=?', $record->primary_id_field ), 'cms_custom_database_8.field_68 ASC', array( $start, $limit ) );}} {{$pages = ceil($total / $limit);}} <div> {template="pagination" group="global" app="core" location="global" params="$baseUrl, $pages, $page, $limit, TRUE, 'page'"} </div> The problem is that when page 2 and so on are requested, IPS automatically redirects the URL to original record url (no pagination at all). Is there a way to add pagination on record view template (avoid auto redirect)?
sobrenome Posted December 2, 2020 Author Posted December 2, 2020 I have changed the $baseUrl to: {{$baseUrl = \IPS\Http\Url::internal( 'app=cms&module=pages&controller=page', 'front', 'content_page_path');}} But now there is no pagination number attached to the pages URL. I see that on record view there is pagination for comments (?tab=comments) and reviews (?tab=reviews). Can I add my own custom tab to paginate the records from another database?
Recommended Posts