沉冰浮水

沉冰浮水

做最终到的事,成为最终成为的人!
github
bilibili
mastodon
zhihu
douban

"Water Hole" - Operations in Z-BlogPHP Application Development That Can Be Automated

Index#

Index of "Water Hole" Series Tutorials

How to Customize CSS Styles in "Water Hole"

"Water Hole": Automatic Operations in Z-BlogPHP Application Development (Current)

Developer Tools (Exclude Files When Packaging) - Z-Blog App Center:

https://app.zblogcn.com/?id=1254

It seems that this kind of thing happens frequently. I come up with a feature, write a plugin for it, and later think of other features to add. However, the application ID has already been determined...

Automatically Update Application Time and Version Number#

The Z-Blog App Center plugin (client) compares the application's version number and the recorded update time in plugin.xml or theme.xml to determine if there is an update. The user will only receive an update notification if one of them is greater than the version they have.

Developers need to modify the application before updating it to the App Center. However, whether it is using the "Edit Application Information" in the backend of the development site or directly modifying the file, it is a bit cumbersome.

Therefore, the plugin above adds automatic editing of updates when packaging as zba. The date will be modified to the "year-month-day" of the operation. If the dates match, a version number will be added. Each time it will increment by 1 from the lowest segment and carry over when it reaches 99.

Adding Version Information to CSS and JS Imports for Cache Application#

It is troublesome to deal with cached resources in the browser after the user updates the application.

  • Retrieve files: include.php template/header.php template/footer.php;
  • For include.php, the regular expression match is: "/\?v=[0-9\-]{10,}/".

Automatic Application Development Mode#

Development Mode - Z-BlogPHP Documentation:

https://docs.zblogcn.com/php/#/books/dev-app-start?id=%e5%bc%80%e5%8f%91%e6%a8%a1%e5%bc%8f

Enabling this plugin will automatically enable the development mode.

When this plugin is enabled, enabling other plugins and updating the theme will also trigger this operation (isn't it redundant?).

Automatically Enable Dependent Plugins#

If the application to be enabled depends on another plugin, and the corresponding plugin already exists but is not enabled, it will be automatically enabled.

You will still see the error page, but just refresh it.

Generate VSCode Workspace Files Automatically#

The plugin includes a usr_cfg\app.code-workspace file. If you use VSCode as your editor, you can modify usr_cfg to usr, and then whenever you enable any application, a copy will be made to the application directory (if it doesn't already exist) and renamed as "[appID].code-workspace".

The workspace includes the "zb_system" folder for easy searching of system code. It also solves the problem of PHP function definition and autocompletion prompts.

"VSCode" PHP Cross-Folder Function Definition Prompt_Computer Network_Chen Bingfu Shui:

https://www.wdssmq.com/post/20200930532.html

Automatically Copy the about.php File#

If usr\about.php exists, it will also be automatically copied. You need to manually include it in main.php.

I use code snippets in div.SubMenu to quickly generate the following code:

<a href="main.php" title="Home"><span class="m-left m-now">Home</span></a>
<?php require_once "about.php"; ?>

Note: This operation will check the application author. It will only copy if it matches the configured author.

Quick Rebuild of Template Compilation and Module Content#

In development mode, accessing the frontend still requires triggering a rebuild when the theme template is modified.

You can trigger a rebuild by adding ?dev to the frontend URL, including the built-in sidebar module content.

Exclude Specified Files (Folders) When Packaging as zba#

This was the original intention of writing this plugin. Although Z-BlogPHP now has this feature built-in, you need to set "zbignore.txt" for each application. The "FileIgnore" plugin can apply the configuration to all applications.

The path for the common rule is zb_users\plugin\FileIgnore\.gitignore, which is automatically generated during the first installation and can be manually adjusted later. Updating the plugin will not overwrite it.

The common rule will be merged with the .gitignore in the plugin directory and used together.

Important: If a certain content in the application needs to be excluded in git but included when publishing as zba, please use "zbignore.txt". It will bypass the plugin's exclusion mechanism.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.