Dede weaving dream Call top level two column and the next three Level column method (database implementation)

Source: Internet
Author: User

    • The last time there was a two-level column that could call a dream, say, "Call level three, even infinite pole."
    • ①: Through the Dede call two level column everyone will call, but to call three level column , it is a bit troublesome, the following style of three column Dede how to call it? As follows:

      ----------------------------------------A-Class main section
      + Top Section
      + Two level column
      + Level three column (A)
      + Level three column (B)
      + Level three column (C)
      + Two level column
      + Level three column (D)
      + Three level column (E)
      + Three level column (F)
      ----------------------------------------Class B main section
      + Top Section
      + Two level column (G)
      + Two level column (H)
      + Level two column (I)

      {dede:channelartlist typeid=6 row=4} (Note: This is the top-level column ID)
      <div class= "CPMLL" >
      <span><a href= "{dede:field name= ' typeurl '/}" >{dede:field name= ' TypeName '/}</a></span> (note: This is the level two column name)
      <ul>
      {dede:sql sql= ' Select * from Dede_arctype where reid=~id~ ORDER by ID limit 0,7 '}
      <li><a href= ' [Field:typedir function= ' Str_replace ("{Cmspath}", "", @me) '/] ' target= ' _blank ' >[field: Typename/]</a></li> (Note: This is the static path and column name of Level three column)
      {/dede:sql}
      </ul>
      </div>
      {/dede:channelartlist}

    • Because [Field:typedir/] in the database store path includes {Cmspath} This string, so we have to deal with the Dream (DEDECMS) with the cn_substr of this system function, here briefly say the parameters of this function, @ The Me is the current field value, which is the value of [field:typedir/] taken out, and 200 and 9 means that 200 characters are intercepted starting from the 9th character position (excluding this character).
      Typeid= "To specify the top-level column on it, limit0,7 this 7 is to control the number of three-level columns display, the display style of self-tuning CSS.

    • ②:

    • There may be a lot of people because of various needs, whether it is increased density or operational convenience to enhance the user experience, will involve Dede need to increase the level of three or deeper navigation needs, we do not say much of the monk nonsense, directly on the code: <ul><li>{dede:type  typeid= ' 3 '}<a href= "[field:typelink/]" >[field:typename/]{/dede:type}</a>  (This can be used if the above two-level name cannot be dropped)     <ul>    {dede:channelartlist typeid= ' 3 '}    <li><a href= ' {dede:field name= ' typeurl '/} ' >{dede:field  Name= ' TypeName '/}</a>    <ul>    {dede:sql sql= ' Select * from dede_arctype where reid=~id~ '}    <li><a  href= ' [field:typedir function= ' Str_replace ("{Cmspath}", "", @me) '/] ' >[field:typename/]</a> </li>    {/dede:sql}    </ul>    </ Li>   {/dede:channelartlist}    </ul></li> </ul> The above code can achieve theoretically infinite level depth of navigation menu call, haha, of course, as long as you need to be satisfied, the display effect needs CSS to decorate.

Dede Dream call top Level two column and Next Level three column method (database implementation)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.