How to call the document category list using zblogPHP

Source: Internet
Author: User
Tags foreach php website

Zblog php calls a list of articles containing sub-classification articles


When a CMS Enterprise template of zblog php version is called using the GetList function to specify a classification document, it is found that only the document with the specified ID is called, the subcategory document under this ID category is not displayed in the call results. For consultation at the zblog official forum, the administrator replied that the GetList function parameter is not set completely (so you should study the function carefully ).


Complete code:


    {Foreach GetList (number of articles, Category ID, null, array ('has _ subcate '=> true) as $ related}

    • {$ Related. Title}

    {/Foreach}



    Number of articles: Arabic numerals, indicating the number of articles to call;


    Category ID: the ID of the category that can be called. You can view it in the background-category management.


    Note: If the function does not call a sub-category article, go to the background, Click Configuration management in the upper right corner, select page settings, and switch "list all sub-categories" on.



    The number of articles in the current category is displayed after the Z-Blog PHP website category


    The effect is similar to that of the built-in document archiving module.


    {Foreach $ categorys as $ category}

    • {$ Category. Name} ({$ category. Count })

    {/Foreach}



    Z-Blog PHP calls the method of specifying multiple article IDs


    When working as an enterprise station, we often need to call a series of pages about us and contact us about the side columns. However, it is not convenient to write the code. Here is a simple method.


    {Php}

    $ Array = explode (',', 2, 3, 4 );

    {/Php}

    {Foreach $ array as $ dir}

    {$ Related = GetPost (int) $ dir )}

    • {$ Related. Title}

    {/Foreach}


    2, 3, and 4 in the second line of the code indicate the ID of the page to be called, which are separated by lowercase commas. There is no limit on the number of pages.


    Of course, 2, 3, and 4 can also be called using variables, which can be easily modified in the background.


    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.