In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you "how to add plug-ins in oneThink background". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to add plug-ins in oneThink background".
With its convenient station building, rich expansion, flexible secondary development, and the support of cloud services, OneThink brings new opportunities and opportunities for individuals and enterprises to build stations, and is about to become a new trend rider of the Internet.
Introduction to OneThink features:
1. Based on the latest version of ThinkPHP, Thinkphp3.2.
two。 Modularization: brand-new architecture and modular development mechanism to facilitate flexible expansion and secondary development.
3. Document model / classification system: by binding to the document model, and different document types, different classifications can achieve differentiated functions, such as information, downloads, discussions and pictures.
4. Open source free: OneThink follows the Apache2 open source agreement and is available for free.
5. User behavior: support custom user behavior, which can record and share the behavior of individual users or groups of users, and provide effective reference data for your operational decisions.
6. Cloud deployment: you can easily support the deployment of the platform through a driven way, allowing your website to migrate seamlessly, with built-in support for SAE.
7. Cloud service support: support services such as cloud storage, cloud security, cloud filtering and cloud statistics will be launched soon. More intimate services will make your website feel more at ease.
8. Security and robustness: provide robust security policies, including backup and recovery, fault tolerance, prevention of malicious attacks, login, web tampering prevention and other security management functions to ensure the safe, reliable and stable operation of the system.
9. Application repository: the official application repository has a large number of third-party plug-ins and application modules, template themes, and many contributions from the open source community, making your website "One" beautiful.
To add a plug-in to the oneThink backend:
Version: V1.1.141212 (Note: there are also many versions of v1.1, accidentally went down to V1.1.140202, there are other versions, it is recommended to go to the code hosting platform to download the latest version)
I'm not lazy either. I write down every step.
First, go to the background and create a plug-in
I have created a new indexFooter for the hook here, because I only need to display the link at the bottom of the front page. Let's check all the places above. As for the difference, you can create a few examples to distinguish whether the generated files are the same. OK! Here our link plug-in has been created! Click OK. (leave all the custom templates here. I will demonstrate the effect of adding custom templates in the next article.)
Second, click "install", find the Links plug-in we have just installed, click "Settings", you will see that it has a default "whether to turn on random" option, here we do not care about it, because we can not use it, we will delete it later. After installation, we can see our new "friendly link" in the "installed plug-in background" navigation on the left.
Third, when we click the "Friendship Link" in the left navigation, you will find that an error is reported, which probably means that a table does not exist. Yes, we just built a plug-in, and if it comes to storing data in the database, we also need to build tables. Here do not go directly to the database to build, because to do so, is very imhumane. Then we can find the function to install the plug-in and set up the database when installing the plug-in. First of all, all the plug-ins of the system are stored in the root directory / Addons/ folder, open this folder, we see a Links folder, this is the plug-in we just created, a plug-in corresponds to a folder. Open the Links folder. There are 2 files and 2 folders in it.
Fourth, its implementation in oneThink is becoming more and more concise, people who do not understand PHP will still create plug-ins, and then you will find out. Of course, if you have your own ideas and don't want to be limited to official restrictions, you should learn php well.
5. Open the plug-in entry file: there is a class LinksAddon in LinksAddon.class.php. Let's analyze this file first.
I changed the model value of the $admin_list array to links here to correspond to the plug-in. Next, we add the statement to create a new database in the install method, so that when we install the plug-in, we will create a new database. My code is as follows:
Public function install () {/ / method to install the plug-in / / 1, add datasheet $model = D (); $db_prefix = C ('DB_PREFIX'); $table_name = "{$db_prefix} links" $sql=array (/ / what is defined here is that the header name displayed in the fields in the table except the id serial number supports functions and links like the model 'title: website name', 'link: link', 'summary: description', 'create_time | time_format: add time', / / time_format is a function to format the time Other functions you want to use can also be written in this format:'id: operation: [EDIT] | Edit, [DELETE] | Delete')
Save and refresh the list of background links
Let's click "add" to add a link, and you will find that there is only one title field. Let's open the Model/LinksModel.class.php file, and I'll explain the two self-contained arrays here, taking a look at the comments in the following code
Class LinksModel extends Model {public $model = array ('title'= >', / / add [title], edit [title], delete [title] prompt 'template_add'= >', / / Custom add template Custom html edit.html will read the template 'template_edit'= >' of the plug-in root directory, / / Custom Editing template html 'search_key'= >', / / search field name The default is title 'extend'= > 1, / / whether the "add" and "delete" buttons are displayed in the background list, 0-do not show 1-display) Public $_ fields = array ('id'= > array (' name'= > 'id',// field name, corresponding to the database field' title'= > 'ID',// display title' type'= > 'num',// field type: num, string, textarea, datetime, bool, select, radio, checkbox, editor, picture (cover), file (attachment),' remark'= >', / / remarks Equivalent to tip 'is_show'= > 3 type', title'= / 1 in the configuration-always show 2-add display 3-Edit display 0-do not show' value'= > 0 Gramps / default), / / the following demonstrates how the select field displays the same radio and checkbox as' type'= > array ('name'= >' type', 'title'= >' Type', 'type'= >' select') 'remark'= >' Please select the type', 'is_show'= > 1,' extra'= >'0: links, 1: cooperative sites, 'value'= > 0,' is_must'= > 1,) }
Ok, my final effect is as follows:
Add a piece of data to see:
To display specific types, pictures, etc., you need to customize the adminlist.html template. About custom templates, we'll talk about it in the next article. When it comes to hooks, you just write a function to read data from the database and then call the hook where the foreground needs it. If you need a template, parse the template in the hook function. The hook call format is general:
{: hook ("hook name"), "[parameter]"} No parameter is written. Write it directly as {: hook ("hook name")}
The above is all the content of this article "how to add plug-ins in oneThink background". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.