In the flexible content management system of AnQiCMS, site operators often need to display some key information of background configuration in the website template according to business needs.Among other things, the setting of 'Independent Backend Domain' concerns the security of the system. In certain specific scenarios, it may also be necessary to display it on the front end of the website, such as a quick access entry for internal personnel, or for information description on a specific page.

Today, let's delve into how to cleverly call and display the independent domain configured in the AnQiCMS template.

Understand the importance of the independent domain in the background.

AnQiCMS provides the function of setting an independent domain name for the background, which is crucial for enhancing system security.Separating the background login address from the website's front-end address can effectively reduce the risk of being maliciously scanned and attacked.

You can find and configure in the AnQiCMS backend“Background Settings” -> “Global Feature Settings”page'Backend Domain Address'This item. Make sure that the domain has been correctly resolved to your server and bound successfully on the server, otherwise you will not be able to access the backend normally.

Call the background independent domain in the template

The AnQiCMS template system is very powerful and easy to use, it adopts a syntax similar to the Django template engine. To obtain various global information of the background settings, we mainly rely onsystem.

systemTags are used to call system global configurations. Their basic usage is{% system 变量名称 with name="字段名称" %}.nameParameters are used to specify the configuration items you want to retrieve.

Although the AnQiCMS documentation does not explicitly list the parameter name for the background domain address,namebut according to other system settings (such asSiteName/BaseUrlThe naming convention, we can reasonably infer its internal call name asAdminUrl.

Now, let's see how to apply it in the template:

1. Directly output the independent domain of the background:

If you just want to simply display the background domain at a certain position on the page, you can do it directly insystemUsed in tagsname="AdminUrl":

<p>您好,内部管理系统入口: <strong>{% system with name="AdminUrl" %}</strong></p>

2. Assign the independent background domain to a variable and use it:

If you need to process the backend domain you have obtained, or use it multiple times in a template, you can first assign it to a variable, making the code clearer:

{% system adminBackendDomain with name="AdminUrl" %}

{% if adminBackendDomain %}
    <p>管理员请点击此处登录:<a href="{{ adminBackendDomain }}" target="_blank" rel="nofollow">{{ adminBackendDomain }}</a></p>
    <p>如果您遇到问题,请联系技术支持。</p>
{% else %}
    <p>后台管理域名未配置,请联系系统管理员。</p>
{% endif %}

In the above example, we first use{% system adminBackendDomain with name="AdminUrl" %}The background independent domain name was assigned toadminBackendDomainthis variable. Then, we go through{% if adminBackendDomain %}Determine if the domain exists (i.e., whether it has been configured in the background), and then display it. This is a good programming habit that can avoid page display errors due to missing configuration.

Example of practical application scenarios

  • Internal Management Page Prompt:On the page specially prepared for internal staff, the back-end login entry can be clearly displayed for easy access by staff.
  • Corporate Intranet Portal:In the internal website portal used, AnQiCMS backend can be used as a shortcut entry for one of the internal systems.
  • Development debugging information:During the development or testing phase, it may be convenient to temporarily display the backend domain name in the footer, but it must be removed after going live.
  • Security Information Disclosure (Special Cases):In rare cases, it may be necessary to disclose the separation status of the background domain and the front-end domain to comply with certain security audits or internal regulations.

Points to note

  • Consideration of security:Unless there is a clear internal need, it is generally not recommended to directly display the independent backend domain on a public-facing front-end page. This may increase the risk of the backend being detected.
  • Domain configuration first:Call in the templateAdminUrlBefore, make sure you have correctly configured the 'Global Function Settings' in the AnQiCMS backend and that the domain name has completed DNS resolution and server binding. If not configured,AdminUrlMay return an empty value or the home page address plus/system/the suffix depends on the internal logic of AnQiCMS.
  • Cache cleanup:After modifying the template file, sometimes you need to manually clean the system cache of AnQiCMS (更新缓存feature) or the browser cache to ensure that the new template content takes effect in a timely manner.

By using the above method, you can flexibly call and display the independent domain name in the AnQiCMS template to meet your specific operational needs.The strength of AnQiCMS lies in its high customizability, allowing you to easily control the display and management of content.


Frequently Asked Questions (FAQ)

1. If I have not set up an independent domain for the background,AdminUrlwhat will the tag display?

If you have not configured the "Background Domain Address" in the "Global Function Settings" of the AnQiCMS background, then{% system with name="AdminUrl" %}Tags usually return the root domain of your website plus the default admin path, for examplehttp://yourdomain.com/system/. However, to avoid uncertainty, it is strongly recommended that you always explicitly set a separate admin domain and according to{% if adminBackendDomain %}The way to judge and display.

2. Can I directly modify or submit the backend domain in the template?

No. In the template,systemThe tag is only used forreadingThe parameter is configured on the back-end, it is a read-only operation. You cannot modify any back-end configuration items through template code, including the back-end independent domain name.All changes to backend settings must be made through the AnQiCMS administrative backend interface to ensure data security and system stability.

3. BesidesAdminUrlWhat are some commonly used system information that can be accessed throughsystemtag calling?

systemTags can call many useful global information, such as:

  • SiteName(Website Name)
  • SiteLogo(Website Logo Image Address)
  • BaseUrl(Homepage Address)
  • MobileUrl(Mobile Website Address, if a separate mobile domain is configured)
  • SiteIcp(Website Record Number)
  • SiteCopyright(Website Copyright Information)
  • TemplateUrl(Current template static files (CSS/JS