Yii Framework Forum: [Solved] Nested Ordered List In Formathtml - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Solved] Nested Ordered List In Formathtml Rate Topic: -----

#1 User is offline   CedSha 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 06-June 12

Posted 23 March 2013 - 12:43 PM

Hi all, ... :)

I am trying to display a three level nested list. While everything go smoothly if I put 3 unordered lists, if I change the top one to be ordered list only the first item has number then there is one unexpected closing </ol> tag.
Am I missing something or is this a bug ?

$html = '
<ol>
<li>EXCALIBUR2</li>
<ul>
<li>A : 279</li>
<ul>
<li>30 <i>(0004041)</i></li>
</ul>
</ul>
<li>EXCALIBUR1</li>
<ul>
<li>B : 179</li>
<ul>
<li>30 <i>(0004042)</i></li>
<li>40 <i>(0004043)</i></li>
...
</ul>
</ul>
</ol>';
echo Yii::app()->format->formatHtml($html);

0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,074
  • Joined: 16-February 11
  • Location:Japan

Posted 23 March 2013 - 07:05 PM

/* Moved from "Bug Discussions" to "General Discussion for Yii 1.1.x" */
0

#3 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,074
  • Joined: 16-February 11
  • Location:Japan

Posted 23 March 2013 - 07:19 PM

Hi CedSha,

You have to put the closing tag of </li> after the nested inner list.
$html = '
<ol>
  <li>EXCALIBUR2         <!-- no closing </li> here -->
    <ul>
      <li>A : 279        <!-- no closing </li> here -->
        <ul>
          <li>30 <i>(0004041)</i></li>
        </ul>
      </li>              <!-- closing </li> should be here -->
    </ul>
  </li>                  <!-- closing </li> should be here -->
  <li>EXCALIBUR1
    <ul>
      <li>B : 179
        <ul>
          <li>30 <i>(0004042)</i></li>
          <li>40 <i>(0004043)</i></li>
        </ul>
      </li>
    </ul>
  </li>
...

0

#4 User is offline   CedSha 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 06-June 12

Posted 25 March 2013 - 04:36 PM

Hi softark,

Nice ! :rolleyes:
I have been convinced in my bad using of this nested list by the w3schools.com which give good result with my bad formatted list !
Tks for your time teaching me how to use it (which is not really Yii related...)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users