A
A
Andrey Berezhnoy2015-09-22 15:41:10
css
Andrey Berezhnoy, 2015-09-22 15:41:10

How to continue numbering?

So. There is a block in which there is a page switch, with the following structure:

<ol>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
</ol> <!-- Page 1 -->
<ol>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
  <li>Text</li>
</ol> <!-- Page 2 -->

<ul class="pagination">
  <li><a href="#page-1">1</a></li>
  <li><a href="#page-2">2</a></li>
</ul>

When switching pages, the numbering starts from zero. How can the numbering continue if each page is a separate block?
UPD: We know about the start attribute , but what is the right way to "squeeze" it if it <ol>is called by an array in PHP?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Ukolov, 2015-09-22
@alexey-m-ukolov

htmlbook.ru/html/ol/start
Example

We know about the start attribute, but what is the right way to “squeeze” it if it <ol>is called by an array in PHP?
If you know about the attribute and want help with the php code, then why do you have html in your tags and not php? Where is the php code you need help with? No words just...

D
Dmitry Kravchenko, 2015-09-22
@mydearfriend

start attribute

<ol start="30">
<li>Text</li>
<li>Text</li>
<li>Text</li>
</ol>

30. Text
31. Text
32. Text

G
Gregory, 2015-09-22
@grigruss

Kapets...

echo "<ol start=\"1\">";
foreach($somearray as $val){
    echo "<li>{$val}</li>";
}
echo "</ol>";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question