Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Proposition de modification pour SmartyPaginate session

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Documentation
View previous topic :: View next topic  

Utilisez-vous SmartyPaginate version 1.6?
oui
100%
 100%  [ 1 ]
non
0%
 0%  [ 0 ]
Total Votes : 1

Author Message
tdan
Smarty Rookie


Joined: 27 Mar 2015
Posts: 8

PostPosted: Sat May 02, 2015 10:52 am    Post subject: Proposition de modification pour SmartyPaginate session Reply with quote

Proposition de modification pour SmartyPaginate v1.6 pour conserver la session de l'URL $_GET['page'].
Raisons: GET['page'] ne se conserve pas quand on clique sur les liens de pagination.

version corrigée:

A define.inc.php:
ajouter ceci à la fin avant ?>:
Code:

if (isset($_GET['page']))
  define('GETPAGE', $_GET['page']);


A index.php (gestion de route en racine):
chercher:
Code:

// Gestion de Routing
if (isset($_GET['action']) && file_exists(_CTRL_.'action/'.str_replace('.', '', $_GET['action']).'.php'))
    include(_CTRL_.'action/'.$_GET['action'].'.php');


remplacer par:
Code:

// Gestion de Routing
if (isset($_GET['action']) && file_exists(_CTRL_.'action/'.str_replace('.', '', $_GET['action']).'.php')){
    $_GET['page'] = '&page=index';
    include(_CTRL_.'action/'.$_GET['action'].'.php');}


A function.paginate.first.php
chercher:
Code:

function smarty_function_paginate_first($params, &$smarty) {


ajouter après:
Code:

    $lapage = '&page='.GETPAGE;

note: faire la même chose pour les ...last.php ...middle.php ...next.php ...prev.php

et chercher:
Code:

    return '<a href="' . str_replace('&','&amp;', $_url) . '"' . $_attrs . '>' . $_text . '</a>';


rempacer par:
Code:

    return '<a href="' . str_replace('&','&amp;', $_url) . $lapage . '"' . $_attrs . '>' . $_text . '</a>';


faire la même chose pour les fichiers:
*_last.php :
Code:
return '<a href="' . str_replace('&','&amp;', $_url) . $lapage . $lapage . '"' . $_attrs . '>' . $_text . '</a>';

*_middle.php :
Code:
$_ret .= $_link_prefix . '<a href="' . str_replace('&', '&amp;', $_this_url) . $lapage . '"' . $_attrs . '>' . $_text . '</a>' . $_link_suffix;

*_next.php :
Code:
return $_show ? '<a href="' . str_replace('&','&amp;', $_url) . $lapage . '"' . $_attrs . '>' . $_text . '</a>' : '';

*_prev.php :
Code:
return $_show ? '<a href="' . str_replace('&','&amp;', $_url) . $lapage . '"' . $_attrs . '>' . $_text . '</a>' : '';


J'ai ajouté que la variable «$lapage .»

Maintenant, pour moi, ça marche bien. Si ça peut aider quelqu'un.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Documentation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP