Home  >  Article  >  Backend Development  >  How to use the Duoshuo comment plug-in on ThinkPHP, thinkphp plug-in_PHP tutorial

How to use the Duoshuo comment plug-in on ThinkPHP, thinkphp plug-in_PHP tutorial

不言
不言Original
2018-05-28 16:52:252616browse


How to use the Duoshuo comment plug-in on ThinkPHP, thinkphp plug-in

This article describes how to use the Duoshuo comment plug-in on ThinkPHP. Share it with everyone for your reference. The specific implementation method is as follows:

I visited some websites of netizens before, and many parts of them have changed. For example, the comment module of the article is designed to be harmonious and beautiful, integrating expressions and sharing tools, and can be built like a building. Comments, I was really complimented at that time. It’s so awesome that you can develop such a comment module! I found out later during the chat that they used the Duoshuo comment plug-in.

What is Duoduo?

Duoshuo is a social comment box that pursues the ultimate experience. You can log in and comment with accounts such as Weibo, QQ, Renren, Douban, etc., log in with social accounts, comment, and forward at the same time Go to social platforms (optional) to reply, mark likes, and forward. The cross-platform comment aggregation effect is conducive to effectively increasing return visit traffic. Duosuo has features such as high-quality user experience, speed and stability, deep integration of social recommendations and website building programs, and filtering of spam comments.

Experience Duoduo in ThinkPHP

Just when the comment module of my blog encountered a bottleneck in the development process, Duoduo suddenly appeared at the end of the road. There is another surprise in the village.
My blog is developed based on ThinkPHP. I wanted to use Baidu to see how others use Duoshuo Comments on ThinkPHP, but I was a little disappointed later - it seems that the shortcut will not work, so I have to explore by myself.

I thought using Duoshuo was so complicated, but it seems that I thought too much. I studied for an hour or two and the results came out. Now I will share my experience.

1. Register an account

Go to Duoshuo official website (http://duoshuo.com) to register an account. Go and register an account.

2. Create a site

Log in to Duoshuo account, and then create a site, as shown in the picture:

It’s very simple, you just need to fill in:
1. Site name
2. Site address
3. Duoshuo domain name (that is, a second-level domain name assigned by Duosuo, customized.)
As for other options, leave them blank if you want to and make your own choice. At the end of this step, click Create and it’s OK.

3. Obtain the code

After creating the site previously, click on the background management, and the name of the site just created will appear in the drop-down menu, as shown in the figure

Click on the site created earlier. What I created here is a "blog blog". After opening the page, click Tools, and then get the code. Note that you must choose the general code, as shown in the picture:

Look at the picture above. Many website systems have dedicated codes. The code is there, but there is no ThinkPHP one.

The following is the creation code corresponding to my blog:

Copy code The code is as follows:

<!-- Duoshuo Comment BEGIN -->
<p class="ds-thread"></p>
<script type="text/javascript">
var duoshuoQuery = {short_name:"w3note"};
(function() {
var ds = document.createElement(&#39;script&#39;);
ds.type = &#39;text/javascript&#39;;ds.async = true;
ds.src = &#39;http://static.duoshuo.com/embed.js&#39;;
ds.charset = &#39;UTF-8&#39;;
(document.getElementsByTagName(&#39;head&#39;)[0]
|| document.getElementsByTagName(&#39;body&#39;)[0]).appendChild(ds);
})();
</script>
<!-- Duoshuo Comment END -->

Copy site creation The corresponding universal code and paste it anywhere between the 6c04bd5ca3fcae76e30b72ad730ca86d and 36cc49f0c466276486e50c850b7e4956 of your web page code. If your site uses templates, paste them into the template code. If you still don’t understand, then you can paste the general code into the article template page, then browse the article and refresh it, and you will see the effect. At this time, just adjust the CSS layout appropriately.

Using the above method, you can remove the comment module of your website. Of course, the function of the Duoshuo comment plug-in is by no means limited to this, and the rest will be discussed later.

Finally, here’s the final rendering:


I hope this article will help everyone’s ThinkPHP framework programming. help.

php report plug-in that can be used in thinkphp, and how to use it. Thank you very much

pChart2.1.3

I use thinkPHP in php and then I want I used fpdf to print the pdf report, but now I don’t know how to call the content in fpdf in the action There are many ways to call files in ThinkPHP, such as third-party plug-ins or handwritten classifications. The method I am accustomed to using is:

1. Place the file in Lib/ORG, name it fpdf.class.php, and then use import ("@.ORG.fpdf") to call it in the Action file.
2. The second method is to create the folder yourself, determine the address relative to the entry file, and then include it in the Action file.
require_once("path relative to the entry file");
or
include_once("path relative to the entry file");
I'm not sure how to use FPDF, I just checked it out , it's a pity that I can't open the web page. If just loading a file can solve the problem, I suggest you use the first method, which is more convenient.
If it is a complete code project, I think it is more appropriate for you to use the second method. Just create a plug-in folder yourself and include the files in it.
PS: It can be used to indicate that the call has been successful. In other words, the problem of your question is solved.
The biggest reason for garbled characters is that the encoding method is wrong. What kind of encoding you use when storing, then you need to use the same encoding when writing. Check where you read the data from, and then look Check what encoding format the data is in. I'm not familiar with FPDF, so I don't have many suggestions. But I remember that you can pass an encoding parameter when calling. Write this parameter and see if this happens again.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn