Of course. Let's break down this very common and important DedeCMS (织梦CMS) tag.

Quick Answer
{dede:global.cfg_dz/} is a DedeCMS global variable tag that outputs the main directory path of your website.
Detailed Explanation
What it Does
This tag retrieves and displays the value of a global system configuration variable named cfg_dz. In the DedeCMS backend, this variable is typically found in "System Settings" -> "Core Settings" -> "Website Main Directory".
It's used to get the root path of your site, which is essential for building absolute URLs.
What cfg_dz Stands For
cfg: Stands for "Configuration". This prefix is used for all global settings in DedeCMS.dz: This is the Chinese pinyin abbreviation for "directory zu" (目录组), which translates to "directory group" or simply "main directory".
So, cfg_dz literally means "configuration for the main directory".

Common Use Cases
This tag is most often used within template files (.htm) to ensure that links generated by your site are absolute URLs instead of relative ones. This is crucial for:
- SEO (Search Engine Optimization): Search engines prefer and understand absolute URLs better.
- Avoiding Broken Links: If your site is in a subdirectory (e.g.,
http://www.example.com/my-site/), relative links can easily break. Absolute links are always correct. - Proper Functionality: Some JavaScript, CSS, or PHP scripts require the full URL to work correctly.
Practical Examples
Let's say your website's main URL is http://www.example.com.
Scenario A: Your site is in the root directory.
- Your
cfg_dzsetting is (or empty, depending on the version). {dede:global.cfg_dz/}will output:http://www.example.com/- When used with a link:
<a href="{dede:global.cfg_dz/}/about-us.html">About Us</a> - Resulting HTML:
<a href="http://www.example.com/about-us.html">About Us</a>
Scenario B: Your site is in a subdirectory (e.g., /blog).

- Your
cfg_dzsetting is/blog/. {dede:global.cfg_dz/}will output:http://www.example.com/blog/- When used with a link:
<a href="{dede:global.cfg_dz/}/contact.html">Contact</a> - Resulting HTML:
<a href="http://www.example.com/blog/contact.html">Contact</a>
Best Practice: Combining with {dede:field name='phpurl'/}
While {dede:global.cfg_dz/} gets the main directory, you often need to link to specific sections like the member center, search page, or admin panel. A more robust and common pattern is to combine it with other global tags.
For example, to link to the member center:
<a href="{dede:global.cfg_dz/}{dede:field name='phpurl'/}/member/index.php">Member Center</a>
Here's a breakdown of that common combination:
{dede:global.cfg_dz/}: Provides the base URL (e.g.,http://www.example.com/blog/).{dede:field name='phpurl'/}: Provides the path to the PHP scripts directory (e.g.,/blog/)./member/index.php: The specific script to link to.
This ensures the final URL is always correct, regardless of whether the site is in a subdirectory or not.
Summary
| Tag | Purpose | Common Output |
|---|---|---|
{dede:global.cfg_dz/} |
Gets the main directory path of the website. | http://www.example.com/ or http://www.example.com/blog/ |
{dede:field name='phpurl'/} |
Gets the directory path for PHP scripts (like member, search, etc.). | or /blog/ |
{dede:field name='templeturl'/} |
Gets the directory path for the current template's assets (CSS, JS, images). | /templets/default/ or /blog/templets/default/ |
In short, {dede:global.cfg_dz/} is a fundamental tag for creating reliable, absolute URLs in your DedeCMS website, ensuring your site works correctly from any directory structure.
