Z-blogPHP call article, the first tutorial with different styles

original None but Li 2017-08-09 15:23:42

In fact, I had planned to create a cms blog theme for a long time, but due to my own time and technical constraints, there has always been a problem unsolved, that is, calling the articles under a certain column. The first article has a different arrangement style from other articles. For example, the current blog of our site calls five articles, of which the first article has a different style from the other four, It looks better like this, don't you think?

博客cms布局.jpg

I also thought about using other methods to solve the problem, but none of them is ideal. There are too many codes piled up, which affects the speed of the website, which goes against the original intention of making a theme. I finally learned this skill a few days ago. I saw it in the Tianxing blog tutorial, so the Brieflee theme came out. I have time today to write this tutorial. If you need it, you can take it away directly, Start the graphic tutorial:

 {foreach GetList(5,10) as $key=>$article} {$i=$key} {if $i==0}   <li class="title-img"><a href="{$article.Url}" title="{$article.Title}" target="_blank"><img src="{$article.Img}" alt="{$article.Title}"></a>     {php}$intro= preg_replace('/[\r\n]+/', '', trim(SubStrUTF8(TransferHTML($related->Intro,'[nohtml]'),66)).'...'); {/php}     <p>{$intro}</p></li> {else}     <li><span class="sp-time">{$article.Time('Y-m-d')}</span><span class="sp-title"><a href="{$article.Url}" target="_blank">{$article.Title}</a></span></li> {/if} {/foreach}

Copy the code, and directly modify the number of calls and classification ID of the article (5 is the number of calls, 10 is the classification ID of calls)

design sketch:

李洋博客演示.png

As for the style, you can modify it according to the theme style.

 Scan WeChat

Related reading

Comment

 visitor visitor
Quick reply: expression:
 cancel
 WeChat QR code
 WeChat QR code
 Alipay QR code