Hướng dẫn nâng cấp giao diện từ NukeViet 4.4.02 lên NukeViet 4.5.00 - nukeviet/update GitHub Wiki
Ghi chú: Hướng dẫn này được viết cho các bạn sửa giao diện mặc định của NukeViet. Với các giao diện tự xây dựng, các bạn cần dựa vào đây để chỉnh sửa cho phù hợp.
Thêm lên trên cùng:
var gEInterval,
siteMenu = $("#menu-site-default");
- Sửa lại function checkAll, checkWidthMenu, openID_load, openID_result, tipShow, ftipShow, change_captcha, modalShow, loginForm
- Thêm functions: cookie_notice_hide, isRecaptchaCheck, reCaptcha2Recreate, reCaptcha2OnLoad, reCaptcha2Callback, reCaptcha2ApiLoad, reCaptcha3OnLoad, reCaptcha3ApiLoad
- Xóa functions: reCaptchaLoadCallback, reCaptchaResCallback, add_hint
- Thay đổi nội dung $(document).ready(function() {...})
- Thay đổi nội dung $(window).on('load', function() {...})
Xem các nội dung nêu trên tại đây: https://github.com/nukeviet/nukeviet/blob/nukeviet4.5/themes/default/js/main.js
Thêm ngay trên cùng:
$theme_config = [
'pagination' => [
// Nếu dùng bootstrap 3: 'pagination'
// Nếu dùng bootstrap 4/5: 'pagination justify-content-center'
'ul_class' => 'pagination',
// Nếu dùng bootstrap 3: '',
// Nếu dùng bootstrap 4/5: 'page-item'
'li_class' => '',
// Nếu dùng bootstrap 3: '',
// Nếu dùng bootstrap 4/5: 'page-link'
'a_class' => ''
]
];
Xem mẫu ở đây
tìm đến function nv_mailHTML, tìm đến:
global $global_config, $lang_global;
Thêm xuống dưới:
$title = nv_autoLinkDisable($title);
Xem mẫu ở đây
tìm đến function nv_mailHTML, tìm đến:
$xtpl->parse('main');
return $xtpl->text('main');
}
Thêm lên trên:
if (!empty($global_config['phonenumber'])) {
$xtpl->parse('main.phonenumber');
}
Xem mẫu ở đây
Tìm đến:
$xtpl->parse('main');
$sitecontent = $xtpl->text('main');
Thêm lên trên:
if (defined('SSO_REGISTER_DOMAIN')) {
$xtpl->assign('SSO_REGISTER_ORIGIN', SSO_REGISTER_DOMAIN);
$xtpl->parse('main.crossdomain_listener');
}
if ($global_config['cookie_notice_popup'] and !isset($_COOKIE[$global_config['cookie_prefix'] . '_cn'])) {
$xtpl->assign('COOKIE_NOTICE', sprintf($lang_global['cookie_notice'], NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=siteterms&' . NV_OP_VARIABLE . '=privacy' . $global_config['rewrite_exturl']));
$xtpl->parse('main.cookie_notice');
}
Xem mẫu ở đây
Tìm đến:
<!-- BEGIN: lt_ie9 --><p class="chromeframe">{LANG.chromeframe}</p><!-- END: lt_ie9 -->
Thêm xuống dưới:
<!-- BEGIN: cookie_notice --><div class="cookie-notice"><div><button onclick="cookie_notice_hide();">×</button>{COOKIE_NOTICE}</div></div><!-- END: cookie_notice -->
Xem mẫu ở đây
Tìm đến:
<script src="{NV_BASE_SITEURL}themes/{TEMPLATE}/js/bootstrap.min.js"></script>
Thêm lên trên:
<!-- BEGIN: crossdomain_listener -->
<script type="text/javascript">
function nvgSSOReciver(event) {
if (event.origin !== '{SSO_REGISTER_ORIGIN}') {
return false;
}
if (
event.data !== null && typeof event.data == 'object' && event.data.code == 'oauthback' &&
typeof event.data.redirect != 'undefined' && typeof event.data.status != 'undefined' && typeof event.data.mess != 'undefined'
) {
$('#openidResult').data('redirect', event.data.redirect);
$('#openidResult').data('result', event.data.status);
$('#openidResult').html(event.data.mess + (event.data.status == 'success' ? ' <span class="load-bar"></span>' : ''));
$('#openidResult').addClass('nv-info ' + event.data.status);
$('#openidBt').trigger('click');
}
}
window.addEventListener('message', nvgSSOReciver, false);
</script>
<!-- END: crossdomain_listener -->
Xem mẫu ở đây
Tìm đến:
@font-face {
font-family:'NukeVietIcons';
src:url('../../default/fonts/NukeVietIcons.eot?avyewf');
src:url('../../default/fonts/NukeVietIcons.eot?#iefixavyewf') format('embedded-opentype'),url('../../default/fonts/NukeVietIcons.ttf?avyewf') format('truetype'),url('../../default/fonts/NukeVietIcons.woff?avyewf') format('woff'),url('../../default/fonts/NukeVietIcons.svg?avyewf#NukeVietIcons') format('svg');
font-weight:normal;
font-style:normal;
}
Thay bằng:
@font-face {
font-family: 'NukeVietIcons';
src:
url('../fonts/NukeVietIcons.woff2') format('woff2'),
url('../fonts/NukeVietIcons.woff') format('woff'),
url('../fonts/NukeVietIcons.ttf') format('truetype'),
url('../fonts/NukeVietIcons.svg') format('svg');
font-weight: normal;
font-style: normal;
font-display: swap;
}
Xem mẫu ở đây
Tìm đến:
.centered {
text-align: center;
font-size: 0
}
.centered > div {
float: none;
display: inline-block;
text-align: left;
font-size: 14px;
}
Thay bằng:
.centered {
display: flex;
justify-content: center;
}
Xem mẫu ở đây
Xóa toàn bộ:
/* guestBlock */
.guestBlock {
width:350px;
}
.guestBlock > h3 {
border-bottom-width :1px;
border-bottom-style: solid;
border-bottom-color: #cccccc;
}
.guestBlock > h3 > a {
display:inline-block;
line-height:34px;
padding:0 17px;
background-color:#e5e5e5;
border-top-right-radius:5px;
border-top-left-radius:5px;
}
.guestBlock > h3 > a:hover,
.guestBlock > h3 > a.current {
background-color:#cccccc;
}
Tìm đến:
.nv-recaptcha-compact {
margin: 0 auto;
width: 164px;
height: 144px;
}
Thêm xuống dưới:
.grecaptcha-badge {
visibility: hidden;
}
Xem mẫu ở đây
Thêm xuống dưới cùng:
/*cookie-notice popup*/
.cookie-notice {
position:fixed;
bottom: 20px;
left: 20px;
width: 350px;
z-index:99999999999999;
background-color: #eee;
border: solid 1px #dedede;
border-radius: 4px;
box-shadow:0 0 4px rgba(0,0,0,0.15);
}
.cookie-notice a {
color: #1a3f5e;
text-decoration: underline;
}
.cookie-notice div {
position: relative;
width: 100%;
padding: 20px;
color: #333;
}
.cookie-notice button {
float: right;
margin-top: -20px;
margin-right: -20px;
margin-left: 10px;
margin-bottom: 10px;
width: 40px;
height: 40px;
border: 0;
font-size: 24px;
}
Xem mẫu ở đây
Tìm đến khu vực:
@media (max-width: 499.98px) {
...
}
Thêm vào trong:
.cookie-notice {
left: 0;
width:100%;
}
Xem mẫu ở đây
Tìm đến:
<script type="application/ld+json">
...
</script>
Thêm lên trên:
<!-- Use passive listeners to improve scrolling performance, https://web.dev/uses-passive-event-listeners/?utm_source=lighthouse&utm_medium=unknown -->
<script>jQuery.event.special.touchstart={setup:function(c,a,b){this.addEventListener("touchstart",b,{passive:!a.includes("noPreventDefault")})}};jQuery.event.special.touchmove={setup:function(c,a,b){this.addEventListener("touchmove",b,{passive:!a.includes("noPreventDefault")})}};</script>
Xem mẫu ở đây
- Sửa ở các file tpl hiển thị captcha, ví dụ: themes/default/module/users/login_form.tpl. Tìm đến FORM có chứa các mã hiển thị captcha, ví dụ:
<form action="{USER_LOGIN}" method="post" onsubmit="return login_validForm(this);" autocomplete="off" novalidate>
Thay bằng:
<form action="{USER_LOGIN}" method="post" onsubmit="return login_validForm(this);" autocomplete="off" novalidate<!-- BEGIN: recaptcha3 --> data-recaptcha3="1"<!-- END: recaptcha3 -->>
Xem mẫu ở đây
Tìm đến đoạn kiểu như:
<!-- BEGIN: recaptcha -->
...
<div id="{RECAPTCHA_ELEMENT}"></div>
...
<!-- END: recaptcha -->
div có chứa id="{RECAPTCHA_ELEMENT}" thay bằng:
<div id="{RECAPTCHA_ELEMENT}" data-toggle="recaptcha" data-pnum="4" data-btnselector="[type=submit]"></div>
Trong đó giá trị của data-pnum bằng số bước ngược lên kể từ phần tử này đến khi gặp thẻ FORM (chính là pnum của nv_recaptcha_elements.push ngay dưới), data-btnselector là selector nhận diện nút submit của FORM.
Xóa toàn bộ đoạn mã javascript ở dưới (<script type="text/javascript">...</script>).
Xem mẫu ở đây
Ngoài ra cần tham khảo cách chỉnh sửa các files php khác tại đây
(Không bắt buộc làm việc này nếu code của bạn chỉ có 1 hosting duy nhất)
Tìm tất cả:
{NV_BASE_SITEURL}{NV_ASSETS_DIR}
Nếu đó là đường dẫn đến file tĩnh (js, css, jpg, png, gif...) thay bằng:
{NV_STATIC_URL}{NV_ASSETS_DIR}
Tìm tất cả:
{NV_BASE_SITEURL}{NV_EDITORSDIR}
Nếu đó là đường dẫn đến file tĩnh (js, css, jpg, png, gif...) thay bằng:
{NV_STATIC_URL}{NV_EDITORSDIR}
Tìm tất cả:
{NV_BASE_SITEURL}themes
Nếu đó là đường dẫn đến file tĩnh (js, css, jpg, png, gif...) thay bằng:
{NV_STATIC_URL}themes
Vì lý do bảo mật, hệ thống tự động thêm rel="noopener noreferrer nofollow" vào các link chuyển hướng đến một site khác. Để tránh việc thêm này bạn cần tự thêm vào link đoạn sau:
rel="dofollow"
Nếu giao diện của bạn tồn tại thư mục themes/ten-theme/modules/news thì vào thư mục themes/ten-theme/modules/news, làm các bước sau đối với các file tpl trong thư mục đó:
Cập nhật content.tpl
Thay toàn bộ nội dung file content.tpl bằng nội dung của file themes/default/modules/news/content.tpl
Cập nhật detail.tpl
- Tìm
<li><a class="dimgray" rel="nofollow" title="{LANG.sendmail}" href="javascript:void(0);" onclick="nv_open_browse('{URL_SENDMAIL}','{TITLE}',650,500,'resizable=no,scrollbars=yes,toolbar=no,location=no,status=no');return false"><em class="fa fa-envelope fa-lg"> </em></a></li>
Thay lại thành
<li><a class="dimgray" title="{LANG.sendmail}" href="javascript:void(0);" onclick="newsSendMailModal('#newsSendMailModal', '{URL_SENDMAIL}', '{CHECKSESSION}');"><em class="fa fa-envelope fa-lg"> </em></a></li>
<!-- START FORFOOTER -->
<div class="modal fade" id="newsSendMailModal" tabindex="-1" role="dialog" data-loaded="false">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">{LANG.sendmail}</h4>
</div>
<div class="modal-body"></div>
</div>
</div>
</div>
<!-- END FORFOOTER -->
- Tìm toàn bộ nội dung trong cặp
<!-- BEGIN: files -->
và<!-- END: files -->
thay lại thành
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-download"></i> <strong>{LANG.files}</strong>
</div>
<div class="list-group news-download-file">
<!-- BEGIN: loop -->
<div class="list-group-item">
<!-- BEGIN: show_quick_viewfile -->
<span class="badge">
<a role="button" data-toggle="collapse" href="#file-{FILE.key}" aria-expanded="false" aria-controls="file-{FILE.key}">
<i class="fa fa-eye" data-rel="tooltip" data-content="{LANG.preview}"></i>
</a>
</span>
<!-- END: show_quick_viewfile -->
<!-- BEGIN: show_quick_viewimg -->
<span class="badge">
<a href="javascript:void(0)" data-src="{FILE.src}" data-toggle="newsattachimage">
<i class="fa fa-eye" data-rel="tooltip" data-content="{LANG.preview}"></i>
</a>
</span>
<!-- END: show_quick_viewimg -->
<a href="{FILE.url}" title="{FILE.titledown} {FILE.title}" download>{FILE.titledown}: <strong>{FILE.title}</strong></a>
<!-- BEGIN: content_quick_viewfile -->
<div class="clearfix"></div>
<div class="collapse" id="file-{FILE.key}" data-src="{FILE.urlfile}" data-toggle="collapsefile" data-loaded="false">
<div class="well margin-top">
<iframe height="600" scrolling="yes" src="" width="100%"></iframe>
</div>
</div>
<!-- END: content_quick_viewfile -->
</div>
<!-- END: loop -->
</div>
</div>
- Tìm toàn bộ nội dung trong cặp thẻ
<!-- BEGIN: allowed_rating -->
và<!-- END: allowed_rating -->
thay lại thành
<div class="news_column panel panel-default">
<div class="panel-body">
<form id="form3B" action="">
<div class="h5 clearfix">
<p id="stringrating">{STRINGRATING}</p>
<!-- BEGIN: data_rating -->
<span itemscope itemtype="https://schema.org/AggregateRating">
<span class="hidden d-none hide" itemprop="itemReviewed" itemscope itemtype="https://schema.org/CreativeWorkSeries">
<span class="hidden d-none hide" itemprop="name">{DETAIL.title}</span>
</span>
{LANG.rating_average}:
<span id="numberrating" itemprop="ratingValue">{DETAIL.numberrating}</span> -
<span id="click_rating" itemprop="ratingCount">{DETAIL.click_rating}</span> {LANG.rating_count}
<span class="hidden d-none hide" itemprop="bestRating">5</span>
</span>
<!-- END: data_rating -->
<div style="padding: 5px;">
<!-- BEGIN: star --><input class="hover-star required" type="radio" value="{STAR.val}" title="{STAR.title}"{STAR.checked}/><!-- END: star -->
<span id="hover-test" style="margin: 0 0 0 20px;">{LANG.star_note}</span>
</div>
</div>
</form>
<script type="text/javascript">
$(function() {
var isDisable = false;
$('.hover-star').rating({
focus : function(value, link) {
var tip = $('#hover-test');
if (!isDisable) {
tip[0].data = tip[0].data || tip.html();
tip.html(link.title || 'value: ' + value)
}
},
blur : function(value, link) {
var tip = $('#hover-test');
if (!isDisable) {
$('#hover-test').html(tip[0].data || '')
}
},
callback : function(value, link) {
if (!isDisable) {
isDisable = true;
$('.hover-star').rating('disable');
sendrating('{NEWSID}', value, '{NEWSCHECKSS}');
}
}
});
<!-- BEGIN: disablerating -->
$(".hover-star").rating('disable');
isDisable = true;
<!-- END: disablerating -->
})
</script>
</div>
</div>
- Tìm toàn bộ nội dung trong cặp thẻ
<!-- BEGIN: socialbutton -->
và<!-- END: socialbutton -->
thay lại thành
<div class="news_column panel panel-default">
<div class="panel-body" style="margin-bottom:0">
<div style="display:flex;align-items:flex-start;">
<!-- BEGIN: facebook --><div class="margin-right"><div class="fb-like" style="float:left!important;margin-right:0!important" data-href="{DETAIL.link}" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div></div><!-- END: facebook -->
<!-- BEGIN: twitter --><div class="margin-right"><a href="http://twitter.com/share" class="twitter-share-button">Tweet</a></div><!-- END: twitter -->
<!-- BEGIN: zalo --><div><div class="zalo-share-button" data-href="" data-oaid="{ZALO_OAID}" data-layout="1" data-color="blue" data-customize=false></div></div><!-- END: zalo -->
</div>
</div>
</div>
Cập nhật sendmail.tpl
Thay toàn bộ nội dung file sendmail.tpl bằng nội dung của file themes/default/modules/news/sendmail.tpl
Nếu giao diện của bạn tồn tại file themes/ten-theme/js/news.js thì làm như sau:
- Tìm
$('[data-toggle="collapsepdf"]').each(function() {
$('#' + $(this).attr('id')).on('shown.bs.collapse', function() {
$(this).find('iframe').attr('src', $(this).data('src'));
});
});
Thay thành
// Xem file đính kèm
$('[data-toggle="collapsefile"]').each(function() {
$('#' + $(this).attr('id')).on('show.bs.collapse', function() {
if ('false' == $(this).attr('data-loaded')) {
$(this).attr('data-loaded', 'true')
$(this).find('iframe').attr('src', $(this).data('src'))
}
})
})
- Tìm
$('[data-toggle="newsattachimage"]').click(function(e) {
e.preventDefault();
modalShow('', '<div class="text-center"><img src="' + $(this).data('src') + '" style="max-width: 100%;"/></div>');
});
Thay thành
// Xem ảnh đính kèm
$('[data-toggle="newsattachimage"]').click(function(e) {
e.preventDefault();
modalShow('', '<div class="text-center"><img src="' + $(this).data('src') + '" style="max-width: 100%; height: auto;"/></div>');
});
- Tìm
$(window).on('load', function() {
Thêm lên bên trên
function newsSendMailModal(fm, url, sess) {
var loaded = $(fm).attr('data-loaded');
if ('false' == loaded) {
$.ajax({
type: 'POST',
cache: !1,
url: url,
data: 'checkss=' + sess,
success: function(e) {
$('.modal-body', $(fm)).html(e);
if ($('[data-toggle=recaptcha]', $(fm)).length) {
reCaptcha2Recreate($(fm));
"undefined" != typeof grecaptcha ? reCaptcha2OnLoad() : reCaptcha2ApiLoad()
} else if ($("[data-recaptcha3]", $(fm)).length && "undefined" === typeof grecaptcha) {
reCaptcha3ApiLoad()
}
$(fm).attr('data-loaded', 'true');
$(fm).modal('show')
}
})
} else {
$(fm).modal('show')
}
}
function newsSendMail(event, form) {
event.preventDefault();
var a = $("[name=friend_email]", form).val();
a = trim(strip_tags(a));
$("[name=friend_email]", form).val(a);
if (!nv_mailfilter.test(a)) return alert($("[name=friend_email]", form).data("error")), $("[name=friend_email]", form).focus(), !1;
a = $("[name=your_name]", form).val();
a = trim(strip_tags(a));
$("[name=your_name]", form).val(a);
if ("" == a || !nv_uname_filter.test(a)) return alert($("[name=your_name]", form).data("error")), $("[name=your_name]", form).focus(), !1;
if ($("[name=nv_seccode]", form).length && (a = $("[name=nv_seccode]", form).val(), a.length != parseInt($("[name=nv_seccode]", form).attr("maxlength")) || !/^[a-z0-9]+$/i.test(a))) return alert($("[name=nv_seccode]", form).data("error")), $("[name=nv_seccode]", form).focus(), !1;
$("[name=your_message]", form).length && $("[name=your_message]", form).val(trim(strip_tags($("[name=your_message]", form).val())));
a = $(form).serialize();
$("input,button,textarea", form).prop("disabled", !0);
$.ajax({
type: $(form).prop("method"),
cache: !1,
url: $(form).prop("action"),
data: a,
dataType: "json",
success: function(b) {
$("input,button,textarea", form).prop("disabled", !1);
var c = $("[onclick*='change_captcha']", form);
c && c.click();
($("[data-toggle=recaptcha]", form).length || $("[data-recaptcha3]", $(form).parent()).length) && change_captcha();
"error" == b.status ? (alert(b.mess), b.input && $("[name=" + b.input + "]", form).focus()) : (alert(b.mess), $("[name=friend_email]", form).val(''), $("[name=your_message]", form).length && $("[name=your_message]", form).val(''), $("[data-dismiss=modal]", form).click())
}
})
}
Nếu giao diện của bạn tồn tại file themes/ten-theme/modules/news/theme.php thì làm như sau:
- Tìm và xóa
$xtpl->assign('LANGSTAR', $news_contents['langstar']);
- Tìm
$xtpl->assign('NUMBERRATING', $news_contents['numberrating']);
Thay lại thành
foreach ($news_contents['stars'] as $star) {
$xtpl->assign('STAR', $star);
$xtpl->parse('main.allowed_rating.star');
}
- Tìm
if ($file['ext'] == 'pdf') {
$xtpl->parse('main.files.loop.show_quick_viewpdf');
$xtpl->parse('main.files.loop.content_quick_viewpdf');
} elseif (preg_match('/^png|jpe|jpeg|jpg|gif|bmp|ico|tiff|tif|svg|svgz$/', $file['ext'])) {
$xtpl->parse('main.files.loop.show_quick_viewimg');
} else {
$xtpl->parse('main.files.loop.show_quick_viewpdf');
$xtpl->parse('main.files.loop.content_quick_viewdoc');
}
Thay lại thành
// Hỗ trợ xem trực tuyến PDF và ảnh, các định dạng khác tải về để xem
if (!empty($file['urlfile'])) {
$xtpl->parse('main.files.loop.show_quick_viewfile');
$xtpl->parse('main.files.loop.content_quick_viewfile');
} elseif (preg_match('/^png|jpe|jpeg|jpg|gif|bmp|ico|tiff|tif|svg|svgz$/', $file['ext'])) {
$xtpl->parse('main.files.loop.show_quick_viewimg');
}
- Tìm
if ($module_config[$module_name]['socialbutton']) {
global $meta_property;
if (! empty($module_config[$module_name]['facebookappid'])) {
$meta_property['fb:app_id'] = $module_config[$module_name]['facebookappid'];
$meta_property['og:locale'] = (NV_LANG_DATA == 'vi') ? 'vi_VN' : 'en_US';
}
$xtpl->parse('main.socialbutton');
}
Thay lại thành
if (!empty($module_config[$module_name]['socialbutton'])) {
global $meta_property;
if (str_contains($module_config[$module_name]['socialbutton'], 'facebook')) {
if (!empty($module_config[$module_name]['facebookappid'])) {
$meta_property['fb:app_id'] = $module_config[$module_name]['facebookappid'];
$meta_property['og:locale'] = (NV_LANG_DATA == 'vi') ? 'vi_VN' : 'en_US';
}
$xtpl->parse('main.socialbutton.facebook');
}
if (str_contains($module_config[$module_name]['socialbutton'], 'twitter')) {
$xtpl->parse('main.socialbutton.twitter');
}
if (str_contains($module_config[$module_name]['socialbutton'], 'zalo') and !empty($global_config['zaloOfficialAccountID'])) {
$xtpl->assign('ZALO_OAID', $global_config['zaloOfficialAccountID']);
$xtpl->parse('main.socialbutton.zalo');
}
$xtpl->parse('main.socialbutton');
}
- Bổ sung xuống cuối file
/**
* author_theme()
*
* @param array $author_info
* @param array $topic_array
* @param array $topic_other_array
* @param string $generate_page
* @return string
*/
function author_theme($author_info, $topic_array, $topic_other_array, $generate_page)
{
global $lang_module, $module_info, $module_name, $module_config, $topicid;
$xtpl = new XTemplate('topic.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_info['module_theme']);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('TOPPIC_TITLE', $author_info['pseudonym']);
$xtpl->assign('IMGWIDTH1', $module_config[$module_name]['homewidth']);
if (!empty($author_info['description'])) {
$xtpl->assign('TOPPIC_DESCRIPTION', $author_info['description']);
if (!empty($author_info['image'])) {
$xtpl->assign('HOMEIMG1', $author_info['image']);
$xtpl->parse('main.topicdescription.image');
}
$xtpl->parse('main.topicdescription');
}
if (!empty($topic_array)) {
foreach ($topic_array as $topic_array_i) {
if (!empty($topic_array_i['external_link'])) {
$topic_array_i['target_blank'] = 'target="_blank"';
}
$xtpl->assign('TOPIC', $topic_array_i);
$xtpl->assign('TIME', date('H:i', $topic_array_i['publtime']));
$xtpl->assign('DATE', date('d/m/Y', $topic_array_i['publtime']));
if (!empty($topic_array_i['src'])) {
$xtpl->parse('main.topic.homethumb');
}
if ($topicid and defined('NV_IS_MODADMIN')) {
$xtpl->assign('ADMINLINK', nv_link_edit_page($topic_array_i['id']) . ' ' . nv_link_delete_page($topic_array_i['id']));
$xtpl->parse('main.topic.adminlink');
}
$xtpl->parse('main.topic');
}
}
if (!empty($topic_other_array)) {
foreach ($topic_other_array as $topic_other_array_i) {
$topic_other_array_i['publtime'] = nv_date('H:i d/m/Y', $topic_other_array_i['publtime']);
if ($topic_other_array_i['external_link']) {
$topic_other_array_i['target_blank'] = 'target="_blank"';
}
$xtpl->assign('TOPIC_OTHER', $topic_other_array_i);
$xtpl->parse('main.other.loop');
}
$xtpl->parse('main.other');
}
if (!empty($generate_page)) {
$xtpl->assign('GENERATE_PAGE', $generate_page);
$xtpl->parse('main.generate_page');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
- Thay thế hàm
sendmail_themme
bằng
/**
* sendmail_themme()
*
* @param mixed $sendmail
* @return string
*/
function sendmail_themme($sendmail)
{
global $module_info, $global_config, $lang_module, $lang_global, $module_config, $module_name, $module_captcha;
$xtpl = new XTemplate('sendmail.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_info['module_theme']);
$xtpl->assign('SENDMAIL', $sendmail);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
if (defined('NV_IS_USER')) {
$xtpl->parse('main.sender_is_user');
}
// Nếu dùng reCaptcha v3
if ($module_captcha == 'recaptcha' and $global_config['recaptcha_ver'] == 3) {
$xtpl->parse('main.recaptcha3');
}
// Nếu dùng reCaptcha v2
elseif ($module_captcha == 'recaptcha' and $global_config['recaptcha_ver'] == 2) {
$xtpl->assign('RECAPTCHA_ELEMENT', 'recaptcha' . nv_genpass(8));
$xtpl->assign('N_CAPTCHA', $lang_global['securitycode1']);
$xtpl->parse('main.recaptcha');
} elseif ($module_captcha == 'captcha') {
$xtpl->assign('GFX_NUM', NV_GFX_NUM);
$xtpl->assign('CAPTCHA_REFRESH', $lang_global['captcharefresh']);
$xtpl->assign('CAPTCHA_REFR_SRC', NV_STATIC_URL . NV_ASSETS_DIR . '/images/refresh.png');
$xtpl->assign('N_CAPTCHA', $lang_global['securitycode']);
$xtpl->assign('GFX_WIDTH', NV_GFX_WIDTH);
$xtpl->assign('GFX_HEIGHT', NV_GFX_HEIGHT);
$xtpl->parse('main.captcha');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
- Tìm bên trong hàm
search_result_theme
đoạn dạng như
$catid_i = $value['catid'];
Thêm xuống dưới
$authors = [];
if (isset($internal_authors[$value['id']]) and !empty($internal_authors[$value['id']])) {
foreach ($internal_authors[$value['id']] as $internal_author) {
$authors[] = '<a href="' . $internal_author['href'] . '">' . BoldKeywordInStr($internal_author['pseudonym'], $key) . '</a>';
}
}
if (!empty($value['author'])) {
$authors[] = BoldKeywordInStr($value['author'], $key);
}
$authors = !empty($authors) ? implode(', ', $authors) : '';
- Tìm
$xtpl->assign('AUTHOR', BoldKeywordInStr($value['author'], $key));
Sửa thành
$xtpl->assign('AUTHOR', $authors);
- Tìm
$xtpl->assign('PDF_JS_DIR', NV_BASE_SITEURL . NV_ASSETS_DIR . '/js/pdf.js/');
Sửa lại thành
$xtpl->assign('PDF_JS_DIR', NV_STATIC_URL . NV_ASSETS_DIR . '/js/pdf.js/');