Home method calls thumbnail zblog php achieved through code

We need to invoke article thumbnail at home at the time to build zblog php website, before zblog asp version is generally achieved through the thumbnails plugin.

zblog php can be better achieved by way of the code.

Judge sentences Code:

PHP
{php}
              $pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";//判断文章是否含有图片 $content = $article->Content; preg_match_all($pattern,$content,$matchContent); {/php} {if isset($matchContent[1][0])} {template:post-multi-t-index}//有图模板 {else} {template:post-multi-w-index}//无图模版 {/if}

There are pictures and template code:

PHP
<ul class="clearfix"> <h1><a href="{$article.Url} " target="_blank">{$article.Title}</a> <span>{$article.Category.Name}</span> </h1> <li> <p ><a href="{$article.Url}" title="{$article.Title}"><img src="{$matchContent[1][0];}" style="float:left;" width="120" height="75" /></a> {php} $temp = preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(Transferhtml($article->Intro,'[nohtml]'),150)).'...'); {/php} {$temp} </p> </li></ul>

No chart template code:

PHP
<ul class="clearfix"> <h1><a href="{$article.Url} " target="_blank">{$article.Title}</a> <span>{$article.Category.Name}</span> </h1> <li> <p > {php} $temp = preg_replace('/[\r\n\s]+/', '', trim(SubStrUTF8(Transferhtml($article->Intro,'[nohtml]'),150)).'...'); {/php} {$temp} </p> </li></ul>

 

Guess you like

Origin www.cnblogs.com/cg123/p/11979792.html