Home > Backend Development > PHP Tutorial > destoon implements the method of calling the current column classification, sub-category and third-level classification, _PHP tutorial

destoon implements the method of calling the current column classification, sub-category and third-level classification, _PHP tutorial

WBOY
Release: 2016-07-13 10:20:24
Original
1108 people have browsed it

destoon implements the method of calling the current column classification, sub-category and third-level classification,

Calling the current column classification, sub-categories and third-level classifications is a common method in programming. This article will describe in detail destoon’s method of calling the current column classification, sub-categories and third-level classifications. The specific operations are as follows:

The following calling statement is provided in destoon:

First-level classification name:

{$m[catname]} 
Copy after login

Second level classification name:

{$c[catname]} 
Copy after login

Third-level classification name:

{$b[catname]} 
Copy after login

The specific calling examples are as follows:

1. Directly call the category name and link:

{loop $maincat $i $m}<dl>
   {php $child = get_maincat($maincat, $CATEGORY, 1);}
   <dt><a href="{$MOD[linkurl]}{$m[linkurl]}" rel="external nofollow" rel="external nofollow" >{$m[catname]}</a></dt>
   {php $childs = get_maincat($m[catid], $CATEGORY, 1);}
   {loop $childs $i $c}<dd><a href="{$MOD[linkurl]}{$c[linkurl]}" rel="external nofollow" rel="external nofollow" rel="external nofollow" >{$c[catname]}</a></dd>{/loop}
</dl>{/loop}
Copy after login

2. Call the category name and the latest articles under it:

{loop $maincat $i $m}
{php $child = get_maincat($maincat, $CATEGORY, 1);}
 <div class="hq01">
  <div class="hq-tt">
  <p><h4>{$m[catname]}</h4>
{php $a = get_maincat($m[catid], $CATEGORY, 1);}
  {loop $a $g}
  {php $f = get_maincat($g[catid], $CATEGORY, 1);}
  {loop $f $i $b}
  <span><a href="{$MOD[linkurl]}{$c[linkurl]}" rel="external nofollow" rel="external nofollow" rel="external nofollow" >{$b[catname]}</a></span>
  {/loop}
  {/loop}
  <span class="hqmore"><a href="{$MOD[linkurl]}{$m[linkurl]}" rel="external nofollow" rel="external nofollow" >[更多]</a></span> </p>
  </div>
  <div class="clear"></div>
  {php $childs = get_maincat($m[catid], $CATEGORY, 1);}
  {loop $childs $i $c}
  <div class="hq-cc">
  <!--{php $tags=tag("moduleid=$moduleid&condition=status=3&areaid=$cityid&length=40&catid=".$c[catid]."&order=".$MOD[order]."&pagesize=5&datetype=2&target=_blank&template=null")}-->
  <ul>
   <li class="li-t"><span><a href="{$MOD[linkurl]}{$c[linkurl]}" rel="external nofollow" rel="external nofollow" rel="external nofollow" >---更多</a></span>{$c[catname]}</li>
   {loop $tags $t}
      <li><!-- <span class="f_r">{date('Y-m-d', $t[addtime])} </span> -->
   <a href="{$t[linkurl]}" rel="external nofollow" {if $target} target="{$target}"{/if}>{$t[title]}</a>
   </li>
   {/loop}
   
  </ul>
  </div>
  {/loop}
  
  <div class="clear"></div>
 </div>
 <div class="clear"></div>
{/loop}
Copy after login

I hope the method described in this article will be helpful to everyone in destoon development.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/867236.htmlTechArticledestoon implements the method of calling the current column classification and sub-category and third-level classification, calling the current column classification and sub-category and Three-level classification is a commonly used method in programming. This article will detail it...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template