Provide zblog template_zblog them_wordpress template download and customization

Method of calling article thumbnail by zblogphp

Tianxing Studio 2014-03-04 19:46 course eleven thousand one hundred and seventy-nine 7 Comments


zblogphp It has been out for a while. Recently, it is being debugged Zblogphp template I have some experience when I share it with you. I hope it can be a reference for you.

This article shares: zblog Php call article thumbnail Function of.

Although zblog is just a blog system, a system like zblog is a little overqualified for just blogging. There is no pressure to do cms. The most common functions of doing cms are those that should always be done like cms. The left thumbnail of the list page and the right article summary are standard configuration.

 Zblogphp calls the method of article thumbnail thumbnail zblogphp tutorial page 1

There are two methods for zblogphp to call article thumbnails at this stage:

First: purchase the "Kandy Picasa" plug-in for 10 yuan each, which has the advantage of simple setting and convenient code calling; The disadvantage is that it seems to slow down a bit. I think after installing this plug-in website The opening speed is a little slow.

Second: directly use the native code of zblogphp. The code is as follows:

 <img src="{php}$pattern="/<[img|IMG].*? src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*? [\/]?>/ "; $content = $article->Content; preg_match_all($pattern,$content,$matchContent); echo $matchContent[1][0]; {/php}" />

The html code compiled from the foreground of these codes is:<img src="image address">, which can be added to any place you want to call.

Advantages of this method: because it is the code of zblogphp itself, it has no impact on the speed; The disadvantage is that this code can only call the first picture in the article by default. If there is no picture in your article, nothing will be displayed tragically. So this method is only applicable to friends who are accustomed to using pictures in every article. Of course, this code may be updated later. Let's look forward to the powerful development team of zblogphp.


Can't find a tutorial that can solve your problem?

You can try to search or ask questions directly online. We also provide charging technical support. If you need it, you can contact us online.

Online questions Online Service

yes seven Comments from netizens:

  •  Netizens of Tianxing Studio

    Netizens of Tianxing Studio 8 years ago (2016-07-27) reply

    No custom thumbnail function

  •  Netizens of Tianxing Studio

    Netizens of Tianxing Studio 8 years ago (2016-06-12) reply

    The code has played a role in calling, but the property has not been changed. The picture is the original size

    •  Netizens of Tianxing Studio

      Netizens of Tianxing Studio 8 years ago (2016-06-12) reply

      Teacher, the size of the picture can be determined, but after the call, if the picture is smaller and there is a blank behind the picture, how to control it? It would be great if the text called by the home page could be adjusted to surround the image

      •  Tianxing Studio

        Tianxing Studio 8 years ago (2016-06-12) reply

        There is a problem with your css settings. Just add a left attribute and set the width and height of the image. In this case, the text surrounds the image.

    •  Tianxing Studio

      Tianxing Studio 8 years ago (2016-06-12) reply

      Otherwise? The image size can be controlled by css, or you can directly use the existing thumbnail plug-in

  •  SM

    SM Nine years ago (June 24, 2015) reply

    Like one.

  •  horsepower

    horsepower 10 years ago (2014-11-29) reply

    Thanks for your help

welcome you Comment: Cancel Reply

 Please fill in the verification code
  • Latest articles
  • Hot article ranking
  • Most Comments
Label aggregation
  • Sign in
  • Registered account Forgot your password?
  • register
  • Already have an account? Direct login Forgot your password?
  • Social account login