How to call Discuz data in Empire CMS

Source: Internet
Author: User
Currently, most messaging systems, generally webmasters, prefer php and mysql combinations. in such cms systems, dede and the Empire are more popular. Forum data is called in the Empire system, which is a common application requirement, when cms and the forum system use the same database, the method provided on the Empire Forum is used for this call. if it is a dede website system, dede's

Currently, most messaging systems, generally webmasters prefer php,MysqlCombination: dede and Empire are more popular in these cms systems. Forum data is called in the Empire system, which is a common application requirement. When cms and the forum system use the same database, using the methods provided on the Empire forum, if it is a dede website system, you can directly use the dede background wizard, but if cms and the Forum use different databases, the premise is that on the same server, the sameMysqlIn the service environment, it cannot be called directly. this involves the multi-Database permissions of mysql Users and cross-database query of mysql.

I have consulted this issue many times before in the Empire forum, but there is no specific implementation method. because I do not usually make a living on an Empire website, therefore, these questions are still based on the consideration of possibility. Today, my friend raised this question and thought it was not a big problem. I just took some time to give it a try. The result is a perfect success. The process is as follows:

Assume that the CMS database name is ecms and the user name is ecms_user,DiscuzForum database name:Discuz, Username: discuz_user

To call the latest post on the day of the discuz forum on the Empire website, first add the access permission for the users of the Empire website system to the discuz Forum. here, only the select permission is added to ensure security. After logging on to phpmysql with root, run the following statement in SQL:

GRANT select on discuz. * to ecms_user;

In this case, you can query the latest posts on the day of the forum with smart tags added to the Empire Template:

 

[E: loop = {"select tid, subject from discuz. cdb_threads order bytid desc limit 10", 10, 24, 0}]

[/E: loop]

-1-1.html "target =" _ blank ">

After the data is updated, the data is generated. The data is actually called by the title and link, rather than the js data call of the general discuz Forum, both Page loading speed and website optimization are good.

Note:

 -1-1.html "target =" _ blank ">

If you have not loaded the pseudo-static effect of the Forum, replace it:

 "Target =" _ blank ">

Otherwise, the "404 Page" will appear when you open the link. So the call is successful.

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.