Forum CMS Made Simple FR

Version complète : [Résolu] Problème de rechargement de la page
Vous consultez actuellement la version basse qualité d’un document. Voir la version complète avec le bon formatage.
Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~
#~ Version du CMS: !1.7/8/9/10/11
#~ Url du site :
#~ Hébergeur / Soft :
#~ Informations Système :
#~~~~~ FIN BLOC A NE PAS SUPPRIMER ~~~~~


Bonjour,

J'ai développé un petit module qui affiche une liste d'item et j'ai mis en place une pagination.
Tous fonctionne correctement, mais mon soucis survient au rechargement de la page lors d'un changement de page. En effet mon module est présent dans une page et dès qu'elle se recharge, tous le reste disparait à part mon module (titre, design de la page, ...).

Voici le module :
Code :
[== PHP ==]
<?php
    // $gCms should always exist. If it doesn't, exit to be safe.
    if (!isset($gCms))
    {
        exit;
    }

    //Test si l'utilisateur à les droits d'accès à ce module
        
    
    //Récupération de la liste des PdBs LAST pour la page souhaitée
    $PdBs = $this->GetPdBsLast($params);
        
    //Création des lien de vote
    foreach ($PdBs as $PdB)
    {
        $PdB->LinkMonterScore = $this->CreateLink($id, 'monterScorePdB', $returnid, $this->DisplayImage('pict_top.png', '','',''), array('idPdB'=>$PdB->id, 'pagePdB'=>'nouveautes'), '', false, false, '');
        $PdB->LinkDescendreScore = $this->CreateLink($id, 'descendreScorePdB', $returnid, $this->DisplayImage('pict_flop.png', '','',''), array('idPdB'=>$PdB->id, 'pagePdB'=>'nouveautes'), '', false, false, '');
    }
    
    //Assigne les variables au Smarty
    $this->smarty->assign('PdBs', $PdBs);
    
    //Récupération du nombre de PdBs LAST
    $nbPdbs = $this->GetNbPdBsLast();
    
    //Création de la pagination
    $nbParPage = 5;
    $nbPage = intval(($nbPdbs)/$nbParPage);
    
    if((($nbPdbs)%$nbParPage)!=0)
    {
        $nbPage ++;
    }
        
    if($nbPdbs > $nbParPage)
    {    
        for($i = 0 ; $i <= count($nbPage) ; $i++)
        {
            if((!isset($params['page'])&&$i == 0) || $i+1 == $params['page'])
            {
                $page = $i+1 ;
                $lienPagination .= '<b>'. $page .'</b> ';
            }
            else
            {
                $lienPagination .= $this->CreateLink($id, 'afficherListeLast', $returnid, $i+1, array('pagePdB'=>'nouveautes', 'page'=>$i+1), '', false, false, '') . ' ';
            }
        }
    }
    else
    {
        $lienPagination = '<b>'. 1 . '</b>';
    }
    
    $this->smarty->assign('LienPagination', $lienPagination);
        
    //Affiche le template
    echo $this->ProcessTemplate('displayListeElements.tpl');
    
?>

Est ce que je me trompe dans la génération de mes liens ? ou alors je n'utilise peux être pas la bonne méthode pour recharger la page.
#~ Version du CMS: !1.7/8/9/10/11

mets toi à jour stp, nous ne faisons pas de support sur ces vielles versions : l'API a changé depuis
C'est bon je suis maintenant à la version 1.11.4 “Fernandina” mais j'ai toujours le même problème...
okay, c'est du front ou du backoffice ton code ? si c'est du front je te conseil d'utiliser plutôt cette méthode

$this->CreateFrontendLink ($id, 'afficherListeLast', $returnid, $i+1, array('pagePdB'=>'nouveautes', 'page'=>$i+1));

à la place de

Code :
$this->CreateLink($id, 'afficherListeLast', $returnid, $i+1, array('pagePdB'=>'nouveautes', 'page'=>$i+1), '', false, false, '') ;


http://apidoc.cmsmadesimple.org/CMS/CMSM...ontendLink


Citation :CreateFrontendLink (line 2482)

Returns the xhtml equivalent of an href link This is basically a nice little wrapper to make sure that id's are placed in names and also that it's xhtml compliant.
string CreateFrontendLink (string $id, string $returnid, string $action, [string $contents = ''], [string $params = array()], [string $warn_message = ''], [boolean $onlyhref = false], [boolean $inline = true], [string $addtext = ''], [boolean $targetcontentonly = false], [string $prettyurl = ''])

string $id: The id given to the module on execution
string $returnid: The id to eventually return to when the module is finished it's task
string $action: The action that this form should do when the link is clicked
string $contents: The text that will have to be clicked to follow the link
string $params: An array of params that should be inlucded in the URL of the link. These should be in a $key=>$value format.
string $warn_message: Text to display in a javascript warning box. If they click no, the link is not followed by the browser.
boolean $onlyhref: A flag to determine if only the href section should be returned
boolean $inline: A flag to determine if actions should be handled inline (no moduleinterface.php -- only works for frontend)
string $addtext: Any additional text that should be added into the tag when rendered
boolean $targetcontentonly: A flag indicating that the output of this link should target the content area of the destination page.
string $prettyurl: An optional pretty url segment (relative to the root of the site) to use when generating the link.

je suis plus certain de l'option $inline et $targetcontentonly, joue avec si du premier coup ça ne passe pas
Ok en effet ça fonctionne.

Par contre il fallait juste que j'inverse une donnée donc le code exacte devient :

Code :
[== Indéfini ==]
$this->CreateFrontendLink ($id, 'afficherListeLast', $returnid, $i+1, array('pagePdB'=>'nouveautes', 'page'=>$i+1));

Merci.