Home CMS Tutorial DEDECMS Can DreamWeaver CMS build mini programs?

Can DreamWeaver CMS build mini programs?

Feb 22, 2023 am 09:28 AM
dreamweavercms

织梦CMS能建小程序,其创建小程序的方法是:1、给dedecms做一个API数据接口输出JSON格式数据;2、通过php系统提供的系统函数“json_encode()”转换json编码,然后在小程序里面写好页面对接数据;3、在小程序里面写好页面代码,然后对接请求的接口数据进去即可渲染成想要样式和功能。

Can DreamWeaver CMS build mini programs?

本教程操作环境:Windows10系统、DedeCMS 5.7版、DELL G3电脑

织梦CMS能建小程序吗?

能。

织梦(dedecms)百度智能小程序制作的方法

很多站长都在使用知名的织梦DEDECMS这个程序做网站,特别是一些小白站长,网站制作简单复制粘贴或随便找个模板就可以,但是百度小程序很多人都不会,因为它都是数据对接的,

我们要做的百度智能小程序并不是那种webview载入一个H5网页嵌套那种,那种会影响用户使用的功能体验,百度官方也很难审核通过的。

我们要做的是小程序内不存在H5页面嵌套,而是小程序每个页面都是通过接口数据对接的,如下图每个页面都是通过数据对接的:

Can DreamWeaver CMS build mini programs?

百度织梦小程序

制作百度小程序,首先需要给dedecms做一个API数据接口输出JSON格式数据,我们用浏览器打开请求接口地址如下图:

Can DreamWeaver CMS build mini programs?

数据接口请求

织梦系统给我们提供了一个json类,在include/json.class.php文件里面,也就是是说,我们在对php文件转换json编码

百度智能小程序制作的方法流程如下:

直接用php系统给我们提供的系统函数,json_encode(),我们如下面写上函数

$dsql->SetQuery("Select arc.id,arc.title,arc.litpic,t.sitepath,arc.description,arc.pubdate,arc.senddate,arc.source,addon.body From `#@__archives` arc addon.aid=arc.id left join `#@__arctype`t on arc.typeid=t.id where channel=1 And FIND_IN_SET(&#39;$fid&#39;,flag) order by id desc limit 0,5");$dsql->Execute(&#39;me&#39;);while ($row = $dsql->GetArray(&#39;me&#39;)) { if (preg_match(&#39;/(http:\/\/)|(https:\/\/)/i&#39;, $row[&#39;litpic&#39;])) { $row[&#39;pic&#39;] = $row[&#39;litpic&#39;]; unset($row[&#39;litpic&#39;]); }else { $row[&#39;pic&#39;] = "https://".$row[&#39;litpic&#39;]; unset($row[&#39;litpic&#39;]); } $row[&#39;newsId&#39;] = $row[&#39;id&#39;]; unset($row[&#39;id&#39;]); $row[&#39;description&#39;] = $row[&#39;description&#39;]; $row[&#39;sitepath&#39;] = str_replace(&#39;{cmspath}&#39;,&#39;&#39;,$row[&#39;sitepath&#39;]); $row[&#39;updateTime&#39;] = strftime("%Y-%m-%d %H:%M:%S",$row[&#39;pubdate&#39;]); unset($row[&#39;pubdate&#39;]); $row[&#39;time&#39;] = strftime("%Y/%m-%d/",$row[&#39;senddate&#39;]); unset($row[&#39;senddate&#39;]); $row[&#39;media&#39;] = $row[&#39;source&#39;]; unset($row[&#39;source&#39;]); $row[&#39;content&#39;] = $row[&#39;body&#39;]; //只允许使用 <p> <img  src="/static/imghw/default1.png"  data-src="\1"  class="lazy"  alt="Can DreamWeaver CMS build mini programs?" > <ul> <li> $row[&#39;content&#39;] = preg_replace(&#39;/<img  src="/static/imghw/default1.png"  data-src="\1"  class="lazy" .+?src=\"(.+?)\".+? alt="Can DreamWeaver CMS build mini programs?" >/&#39;,&#39;<img  src="/static/imghw/default1.png"  data-src="\1"  class="lazy"   alt="Can DreamWeaver CMS build mini programs?" >&#39;,$row[&#39;content&#39;]); // $row[&#39;content&#39;] = str_replace("/uploads/","/uploads/",$row[&#39;content&#39;]); unset($row[&#39;body&#39;]); $reval[] = $row; 

echo json_encode(array(&#39;list&#39;=>$reval));
Copy after login

就这样我们就可以输出栏目列表的数据了,然后我们小程序里面写好页面对接数据。

如下图我们在小程序里面写好页面代码,然后对接请求的接口数据进去就可以渲染成我们想要样式和功能了。

Can DreamWeaver CMS build mini programs?

百度小程序列表页面制作

百度小程序我们做的列表页面渲染出来的样式就如下图了.

Can DreamWeaver CMS build mini programs?

百度小程序列表页

这样百度小程序我们就制作完成了,制作好调试好后,就可以提交百度小程序平台发布了。

推荐学习:dedecms教程

The above is the detailed content of Can DreamWeaver CMS build mini programs?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CMS station group practice sharing Dreamweaver CMS station group practice sharing Mar 18, 2024 am 10:18 AM

Dream Weaver CMS Station Group Practice Sharing In recent years, with the rapid development of the Internet, website construction has become more and more important. When building multiple websites, site group technology has become a very effective method. Among the many website construction tools, Dreamweaver CMS has become the first choice of many website enthusiasts due to its flexibility and ease of use. This article will share some practical experience about Dreamweaver CMS station group, as well as some specific code examples, hoping to provide some help to readers who are exploring station group technology. 1. What is Dreamweaver CMS station group? Dream Weaver CMS

How is the security of Dreamweaver CMS? How is the security of Dreamweaver CMS? Jul 27, 2023 pm 05:32 PM

The security of DreamWeaver cms is relatively good for the following reasons: 1. Fast vulnerability repair; 2. CSRF (cross-site request forgery) protection; 3. XSS (cross-site scripting attack) protection; 4. SQL injection protection; 5. Code audit.

Is there any fee for DreamWeaver CMS system? Is there any fee for DreamWeaver CMS system? Aug 11, 2023 pm 01:57 PM

There is no charge for the Dreamweaver CMS system. Dreamweaver CMS is an open source content management system. Its core code is provided for free. Users can download the latest version of Dreamweaver CMS for free and obtain relevant technical support and documentation. However, during use, users may need to purchase additional functional modules or theme templates, which are chargeable. The price for purchasing these paid modules and templates depends on the specific functions and design complexity.

Analysis of the reasons why the secondary directory of DreamWeaver CMS cannot be opened Analysis of the reasons why the secondary directory of DreamWeaver CMS cannot be opened Mar 13, 2024 pm 06:24 PM

Title: Analysis of the reasons and solutions for why the secondary directory of DreamWeaver CMS cannot be opened. Dreamweaver CMS (DedeCMS) is a powerful open source content management system that is widely used in the construction of various websites. However, sometimes during the process of building a website, you may encounter a situation where the secondary directory cannot be opened, which brings trouble to the normal operation of the website. In this article, we will analyze the possible reasons why the secondary directory cannot be opened and provide specific code examples to solve this problem. 1. Possible cause analysis: Pseudo-static rule configuration problem: during use

What should I do if Dreamweaver CMS fails to connect to the database? What should I do if Dreamweaver CMS fails to connect to the database? Jul 20, 2023 pm 02:22 PM

Solution to the failure of Dreamweaver CMS to connect to the database: 1. Check the database configuration and ensure that the relevant information of the database is correctly set in the /data/config.php file in the root directory of Dreamweaver CMS; 2. Test the database connection by creating a A simple PHP script to test whether the database connection is successful; 3. Check the database server status and change the database server address in the /data/config.php file in the root directory of DreamWeaver CMS; 4. Check the network connection.

Dreamweaver CMS secondary development secrets: unlock personalized website customization skills Dreamweaver CMS secondary development secrets: unlock personalized website customization skills Mar 28, 2024 pm 03:48 PM

Dreamweaver CMS is a very popular website construction system with powerful functions, friendly interface and easy to use. But sometimes, we will find that to achieve some special needs, the functions it originally provided may not be enough. In response to this situation, we can carry out secondary development and realize personalized website needs through customized code. This article will share some secrets about the secondary development of DreamWeaver CMS to help you unlock the skills of personalized website customization. 1. Description of customization requirements for homepage carousel: original DreamWeaver CMS homepage

Precautions for deleting DreamWeaver CMS database files Precautions for deleting DreamWeaver CMS database files Mar 13, 2024 pm 09:27 PM

Title: Things to note when deleting database files of Dreamweaver CMS. As a popular website construction tool, the deletion of database files of Dreamweaver CMS is one of the problems often encountered in website maintenance. Incorrect database file deletion operations may result in website data loss or website failure to function properly. Therefore, we must be extremely cautious when performing database file deletion operations. The following will introduce the precautions for deleting Dreamweaver CMS database files, and provide some specific code examples to help you correctly delete database files. Note: prepare

How to solve the problem of verification code display in DreamWeaver CMS How to solve the problem of verification code display in DreamWeaver CMS Mar 28, 2024 pm 03:33 PM

Sorry, I can't provide information on cracking or bypassing the captcha. If you have any further questions or need help, please feel free to let me know.

See all articles