Today, with the continuous refinement of content operation, how to effectively manage and monetize high-quality content on websites is a major concern for many website operators.AnQiCMS (AnQiCMS) provides a comprehensive solution to easily implement the display and control of paid content or exclusive content for VIP users.This system is not only powerful in function, but also flexible in operation, making content monetization easily accessible.
Core mechanism: User groups and content reading levels
The core of AnQi CMS realizing paid content lies in its built-in 'User Group Management and VIP System' as well as the 'Reading Level' setting at the content level.
Firstly, in the background user group management, we can create different user groups, such as "ordinary members", "senior VIP", "supreme VIP", and so on.Each user group can be assigned a specific permission level (usually represented by numbers, with higher levels indicating greater permissions).In this way, we have clearly labeled the user identity.
Secondly, for each document on the website (including articles, products, etc.), we can specify a 'reading level' when publishing or editing it.This reading level determines the minimum user level required to access this content.For example, the reading level of a regular public article may be 0, while the reading level of a premium VIP exclusive article may be set to 5.
When a user accesses content, the system will compare the user's group permission level and the content's reading level.If the user's permission level reaches or exceeds the content reading level, they are allowed full access;On the contrary, a restricted prompt will be displayed.
Implementation in front-end template: Dynamic display and control
How to dynamically display or hide content on the website front-end based on the user's permission level is the key to implementing paid content control.The powerful template tag system of AnQi CMS provides us with great convenience.
Limit the display of complete content
Assuming we want a document to be open only to VIP users of a specific level, ordinary users can only see prompt information. In the template of the document detail page, we can achieve this logic by the following:
Firstly, we need to obtain the login status and permission level of the current visiting user, as well as the reading level of the current content.The AQ CMS usually provides this information in the form of variables to the template.Assuming the reading level of the current document isarchive.ReadLevelThe current login user's permission level isuser.Leveland canuser.IsLogindetermine if the user has logged in.
Then, the code snippet that controls the display of content in the template may look like this:
{% if user.IsLogin and user.Level >= archive.ReadLevel %}
{# 用户已登录且权限足够,显示完整内容 #}
<div class="full-content">
{{ archive.Content|safe }}
</div>
{% else %}
{# 用户未登录或权限不足,显示提示信息 #}
<div class="vip-exclusive-message">
<p>此内容为VIP专属,请<a href="/login">登录</a>或<a href="/vip-upgrade">升级会员</a>以查看完整内容。</p>
{# 也可以在此处显示部分试读内容 #}
{% if archive.Description %}
<p><strong>试读:</strong>{{ archive.Description }}</p>
{% endif %}
</div>
{% endif %}
This code first checks if the user is logged in and if their permission level is greater than or equal to the content reading level. If the conditions are met, the complete rich text of the content is displayed safely (archive.Content|safeEnsure that the HTML content is parsed correctly). Otherwise, a friendly prompt will be displayed, guiding the user to log in or upgrade.
Exclusive identifier in the content list.
On article lists, product lists, and other pages, to enable users to easily identify which content is exclusive to VIPs, we can add a "VIP" or "Paid" identifier next to the content title. This can be determined during the loop rendering of the content list based on the reading level of each content item:
{% archiveList archives with type="page" limit="10" %}
{% for item in archives %}
<li class="article-item">
<a href="{{ item.Link }}">
<h3>
{{ item.Title }}
{% if item.ReadLevel > 0 %} {# 如果阅读等级大于0,则认为是VIP或付费内容 #}
<span class="vip-badge">VIP专属</span>
{% endif %}
</h3>
<p>{{ item.Description }}</p>
{# 其他内容信息 #}
</a>
</li>
{% endfor %}
{% endarchiveList %}
By checkingitem.ReadLevelWhether greater than 0, we can dynamically add an eye-catching "VIP Exclusive" tag next to the content title, which not only enhances the visibility of VIP content but also encourages ordinary users to upgrade.
精细化控制:Read-only and VIP content segmentation
For some content, we may want to provide a free trial of part of it and then limit the remaining content. Although the Anqi CMS'sContentThe field is default to be whole, but we can achieve it through some strategies:
- Use the 'description' field as a sample reading:In the above example, we have shown how to use
archive.Description(Document summary) as a sample content. - Custom content model field: You can add a custom field called "Sample Content" to the content model. When publishing content, enter the sample part into this new field, and the full paid content into
ContentField. Then, render these two in the template