Good day.

There is a PHP script that displays information from a file page by page. The text file looks like this:

01.01.2000|Название1|Ссылка1 02.01.2000|Название2|Ссылка2 03.01.2000|Название3|Ссылка3 

PHP pagination script can be found here .

Everything is working. But I need the text to be displayed on the page according to a template. In the PHP script, replaced:

 print "$file[$i]<br />"; 

On:

 foreach( $file as $value ): $value = explode( "|", $value ); { echo '<div><small>' . $value[0] . '</small> // <span class="blue"><b>' . $value[1] . '</b></span></div>'; echo '<div style="margin:2px 0px 20px 0px"><a href="/news/' . $value[2] . '" class="deep">Подробнее</a></div>'; } endforeach; 

Pagination displays the correct number of pages, the "explode" function splits the string according to a pattern. But the file itself is displayed all on one page, without pagination.

Thank you in advance for your help.

  • @alegraft, such formatting is impossible to understand - etki
  • Post redid. So clearer? - alegraft
  • Thank you very much "for your help." Here's a solution, if anyone needs it: Replace: for ($ i = $ first; $ i <= $ last; $ i ++): if (@ $ file [$ i]): print "$ file [$ i] <br / > "; endif; endfor; For: for ($ i = $ first; $ i <= $ last; $ i ++): if (@ $ file [$ i]): $ value = explode ("|", trim ($ file [$ i]) ); echo '<div> <small>'. $ value [0]. '</ small> // <span class = "blue"> <b>'. $ value [1]. '</ b> </ span> </ div>'; echo '<div style = "margin: 2px 0px 20px 0px"> <a href="/news/'. $value[2[.'/" class="deep"> Learn more </a> </ div>' ; endif; endfor; - alegraft

0