• Resolved benjamin_sp

    (@benjamin_sp)


    Hi,

    I would really like all list tags

    • within a certain div to show numbering: 1. 2. 3. etc… What is the php code for this?
    • Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • To show numbering, use an ordered list tag <ol> instead of an unordered list tag <ul>.

    Thread Starter benjamin_sp

    (@benjamin_sp)

    Iridiax, that didn’t make any difference – it only caused an indentation towards the left of the list. In the past I used to use this code:

    <?php $my_post_count++; echo $my_post_count . '.'; ?>

    to display numbering. But the above code needs to be entered for every number. For example if I wanted all list items to be numbered I would have to do this:

    • <?php $my_post_count++; echo $my_post_count . ‘.’; ?> Something 1
    • <?php $my_post_count++; echo $my_post_count . ‘.’; ?> Something 2
    • <?php $my_post_count++; echo $my_post_count . ‘.’; ?> Something 3
    • and so on…

      I was wondering if I can say in php: All list items within this div are to be numbered.

      So I can do it in one swoop instead of doing it one by one?

    Thread Starter benjamin_sp

    (@benjamin_sp)

    Anyone have a solution please?

    Maybe try this something like this:

    <ul>
    <?php $my_post_count++; echo '<ol>' . $my_post_count . '.</ol>'; ?>
    </ul>

    Not sure what the ‘.’ is before the closing ‘ol’ tag, so you might need to play with it.

    Actually scratch that. I don’t think what I entered above is what you are looking for. I think you need to enter those tags around that which you want numbered.

    Thread Starter benjamin_sp

    (@benjamin_sp)

    I’m such an idiot, iridiax’s solution does work. I couldn’t see the numbers before because I had a css valuse of display: block on my list which was preventing the numbers from showing for whatever reason. Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Please Help] What is the code to show numbering’ is closed to new replies.