We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16732
    • 592 Posts
    I have tested Footnote with the Pagination plugin and it works find in the way that, in each page the right footnotes are generated.
    BUT, the links too the footnotes send always to the first page because the &page is not included in the Footnote links.

    So here a custom version to handle this case :

        $e = &$modx->Event;
    switch ($e->name) {
            case "OnLoadWebDocument":
                    $o = &$modx->documentObject['content']; // Référence de la sortie
                    // récupération de tous les Npp {-NPP-}
                      if(preg_match_all( '~\{-(.*?)\-\}~' , $o, $tbl_npp)){
    
                           if($modx->config['friendly_urls'] == 1){$page = $modx->documentObject['alias'];}else {$page= 'index.php?id='.$modx->documentObject['id'];}
                           if(isset($_GET['page'])){$page .='&page='.$_GET['page'];}
                           $tbl_npp1 = array_unique($tbl_npp[0]);
                            for($i=0;$i<count($tbl_npp1);$i++) {
                                 $numbNote = $i+1;
                                 $o = str_replace($tbl_npp1[$i],'<sup><a href="'. $page.'#nb'.$numbNote.'" name="nh'.$numbNote.'">'.($i+1).'</a></sup>',$o);
                            }
    
                          $npp .= '<p class="footnotes"><br/><br/>--- Notes ---';
                            for($i=0;$i<count($tbl_npp1);$i++) {
                                $numbNote = $i+1;
                                $npp .= '<br/> [<a href="'. $page.'#nh'.$numbNote.'" name="nb'.$numbNote.'">'.($i+1).'</a>] '.substr(substr($tbl_npp1[$i],2),0,strlen($tbl_npp1[$i])-4);
    
                                //$modx->documentObject['footnotes'][$i]=substr(substr($tbl_npp1[$i],2),0,strlen($tbl_npp1[$i])-4);
                            }
                         $npp .= '</p>';
    
                           $o .=  $npp;
    
                      }
                    else{
                       return;
                    }
    
            break;
            default :
                return;
            break;
    
    }
    


    Hope that helps
      • 21642
      • 23 Posts
      Thank you smiley

      I will try your code; and I’m happy because that is a necessity in a pagination context. Have a nice day.

      Regards,
      Cristian Nica
        • 21642
        • 23 Posts
        smiley

        Work very well. Thanck you and have a good day,

        Cristian Nica