Phpcms releases articles regularly _ PHP Tutorial

Source: Internet
Author: User
Phpcms regularly releases the article solution. The solution to regularly publishing articles in phpcms is complicated to update articles in phpcms. it would be nice if phpcms could update articles regularly. In this way, you can write all the articles in phpcms and publish the articles regularly.
Updating phpcms articles is a complicated task. it would be nice if phpcms could update the articles on a regular basis. In this way, you can write all the articles at a time, and leave the rest of the release time to the system. through recent research, this method is actually available.
Step 1: code modification
Open phpcms \ modules \ content \ index. php

Add the following function

/* Wlsh timed release article set source programmer life www.wfuyu.com note: The article should set a level-1 review and release time should be later than the current time */public function dingshi () {$ this-> content_check_db = pc_base: load_model ('content _ check_model '); $ ids = $ this-> content_check_db-> select ('status = 1 and username = "admin" and inputtime <= '. SYS_TIME, 'checkid'); if (! Empty ($ ids) {foreach ($ ids as $ k) {$ k1 = explode ('-', $ k ['checkid']); $ this-> db-> set_model ($ k1 [2]); $ this-> db-> status ($ k1 [1]) ;}}

Step 2: Add a call to the constructor

Function _ construct () {$ this-> db = pc_base: load_model ('content _ Model'); $ this-> _ userid = param :: get_cookie ('_ userid'); $ this-> _ username = param: get_cookie (' _ username'); $ this-> _ groupid = param :: get_cookie ('_ groupid'); $ this-> dingshi (); // call the scheduled function during Initialization}

Step 3: set a level-1 review
Background-> content-related Settings-> Topic management-> modify a topic

Step 4: publish an article
When publishing an article, select review on the right, and the time is the time when the article is automatically published.

The system will judge that if the time is up, the article will be automatically approved and published

Now we have completed the regular release of phpcms articles. please contact me if you have any bugs. I am exclusively released by the programmer's Life Network. For more information, see the source.

Difficult to live, hard work for coders
If you think the content in this article is helpful to your learning, you can scan the QR code on your mobile phone to donate

Phpcms is a tedious task to update an article. if phpcms can update the article regularly, it will be fine. In this way, you can write all the articles at a time...

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.