Hướng dẫn ẩn nội dung trong các thẻ code với khách cho xenforo

A

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Chức năng:
Ẩn nội dung trong thẻ code, html, php với khách và yêu cầu đăng nhập hoặc đăng ký thành viên.
Hướng dẫn:
1. Ẩn nội dung trong thẻ code
- Vào Admincp > mở template bb_code_tag_code xóa hết đi và thay bằng
HTML:
<xen:require css="bb_code.css" />
 
<div class="bbCodeBlock bbCodeCode">
    <div class="type">{xen:phrase code}:</div>
<xen:if is="!{$visitor.user_id}">
        Bạn phải <a href="{xen:link register}"><strong>đăng ký</strong></a> hoặc <a href="{xen:link login}"><strong>đăng nhập</strong></a> để xem nội dung này.
<xen:else />
    <pre>{xen:raw $content}</pre><xen:comment><!-- content is escaped via parser --></xen:comment>
</xen:if>
</div>

2. Ẩn nội dung trong thẻ html
- Mở tiếp template bb_code_tag_html xóa hết đi và thay bằng
HTML:
<xen:require css="bb_code.css" />
 
<div class="bbCodeBlock bbCodeHtml">
    <div class="type">{xen:phrase html}:</div>
<xen:if is="!{$visitor.user_id}">
        Bạn phải <a href="{xen:link register}"><strong>đăng ký</strong></a> hoặc <a href="{xen:link login}"><strong>đăng nhập</strong></a> để xem nội dung này.
<xen:else />
    <pre>{xen:raw $content}</pre><xen:comment><!-- content is escaped via parser --></xen:comment>
</xen:if>
</div>
3. Ẩn nội dung trong thẻ php
- Mở tiếp template bb_code_tag_php xóa hết đi và thay bằng
HTML:
<xen:require css="bb_code.css" />
 
<div class="bbCodeBlock bbCodePHP">
    <div class="type">{xen:phrase php}:</div>
<xen:if is="!{$visitor.user_id}">
        Bạn phải <a href="{xen:link register}"><strong>đăng ký</strong></a> hoặc <a href="{xen:link login}"><strong>đăng nhập</strong></a> để xem nội dung này.
<xen:else />
    <div class="code">{xen:raw $content}</div><xen:comment><!-- content is escaped via parser --></xen:comment>
</xen:if>
</div>
Để ẩn với thành viên chưa kích hoạt bạn làm như sau
Thay
HTML:
<xen:if is="!{$visitor.user_id}">
Thành
HTML:
<xen:if is="!{$visitor.user_id}  OR {$user.user_state} != 'valid'">
Lưu lại là xong
Chúc các bạn thành công!
 

Facebook Comments

Similar threads

A
Replies
1
Views
1K
pronhan95
P
A
Replies
0
Views
663
AdminAdmin is verified member.
A
A
Replies
0
Views
2K
AdminAdmin is verified member.
A
A
Replies
0
Views
2K
AdminAdmin is verified member.
A
A
Replies
0
Views
2K
AdminAdmin is verified member.
A
Back
Top