Công cụ thành viên

Công cụ trang web


programming4:note

Khác biệt

Đây là những khác biệt giữa hai phiên bản của trang.

Liên kết đến bản xem so sánh này

Phiên bản sau
Phiên bản trước
programming4:note [2016/06/17 07:15] – được tạo ra hoaquynhtim99programming4:note [2016/06/17 07:24] (hiện tại) hoaquynhtim99
Dòng 1: Dòng 1:
-====== Các lưu ý khi lập trình NukeViet 3.x ======+====== Các lưu ý khi lập trình NukeViet 4.x ======
   * Để thêm nội dung vào phần head và footer của site, ta lưu nội dung đó vào hai biến $my_head và $my_footer.   * Để thêm nội dung vào phần head và footer của site, ta lưu nội dung đó vào hai biến $my_head và $my_footer.
 Ví dụ: Ví dụ:
Dòng 6: Dòng 6:
 $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/js/contentslider.js\"></script>\n"; $my_footer .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/js/contentslider.js\"></script>\n";
 </code> </code>
 +
 +Ngoài ra có thể chèn trực tiếp vào các file tpl, khi xuất ra trình duyệt hệ thống tự động đưa js và css về vị trí thích hợp.
 +
   * Để gọi ra editor, thực hiện thao tác:   * Để gọi ra editor, thực hiện thao tác:
 <code php> <code php>
-if ( defined( 'NV_EDITOR' ) ) +if (defined('NV_EDITOR')) { 
-+    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
- require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php' );+
 } }
-if ( defined( 'NV_EDITOR' ) and nv_function_exists( 'nv_aleditor' ) ) + 
-+$row['bodytext'] = htmlspecialchars(nv_editor_br2nl($row['bodytext'])); 
- $data = nv_aleditor( 'description', '100%', '200px', $data);+ 
 +if (defined('NV_EDITOR') and nv_function_exists('nv_aleditor')) { 
 +    $row['bodytext'= nv_aleditor('bodytext', '100%', '300px', $row['bodytext'])
 +} else { 
 +    $row['bodytext'] = '<textarea style="width:100%;height:300px" name="bodytext">' . $row['bodytext'] . '</textarea>';
 } }
 </code> </code>
   * Để mở cửa sổ upload file ta thực hiện:    * Để mở cửa sổ upload file ta thực hiện: 
-<code php+<code javascript
-$("#selectimages").click( function() { +$("input[name=selectimg]").click(function() { 
- nv_open_browse_file( "{NV_BASE_ADMINURL}index.php?{NV_NAME_VARIABLE}=upload&popup=1&area=images&path={IMG_DIR}&type=image", "NVImg", "850""500", "resizable=no,scrollbars=no,toolbar=no,location=no,status=no" ); + var area = "image"; 
- return false; + var alt = "imagealt"; 
- });+ var path = uploads_dir_user; 
 + var type = "image"; 
 + nv_open_browse(script_name + "?" + nv_name_variable + "=upload&popup=1&area=" + area + "&alt=" + alt + "&path=" + path + "&type=" + type, "NVImg", 850, 420, "resizable=no,scrollbars=no,toolbar=no,location=no,status=no"); 
 + return false; 
 +});
 </code> </code>
   * Để mở cửa sổ tìm kiếm ID một thành viên ta thực hiện:   * Để mở cửa sổ tìm kiếm ID một thành viên ta thực hiện:
 <code php> <code php>
 $("#selecteduid").click( function() { $("#selecteduid").click( function() {
- nv_open_browse_file"{NV_BASE_ADMINURL}index.php?+ nv_name_variable + "=users&+ nv_fc_variable + "=getuserid&area=userid""NVImg""850""600""resizable=no,scrollbars=no,toolbar=no,location=no,status=no)+    nv_open_browse('{NV_BASE_ADMINURL}index.php?+ nv_name_variable + '=users&+ nv_fc_variable + '=getuserid&area=userid&return=username&filtersql={FILTERSQL}''NVImg', 850, 500'resizable=no,scrollbars=no,toolbar=no,location=no,status=no'); 
- return false+});
- });+
 </code> </code>
   * NukeViet hỗ trợ các tiến trình tự động, tuy nhiên các tiến trình tự động sẽ không chạy nếu không tồn tại giá trị $_GET['second'] hoặc $_GET['second'] != 'crontjobs', vì vậy trong file theme.php của mỗi theme nhất thiết phải có dòng    * NukeViet hỗ trợ các tiến trình tự động, tuy nhiên các tiến trình tự động sẽ không chạy nếu không tồn tại giá trị $_GET['second'] hoặc $_GET['second'] != 'crontjobs', vì vậy trong file theme.php của mỗi theme nhất thiết phải có dòng 
 <code php> <code php>
-$xtpl->assign( 'THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;p=" . nv_genpass() );+$xtpl->assign('THEME_IMG_CRONJOBS', NV_BASE_SITEURL . "index.php?second=cronjobs&amp;p=" . nv_genpass());
 </code> </code>
 Trong phần cuối của website cần có dòng Trong phần cuối của website cần có dòng
Dòng 40: Dòng 49:
 </code> </code>
 (Thông thường phần cuối thường do file footer.tpl quyết định). (Thông thường phần cuối thường do file footer.tpl quyết định).
-  * Đối với các phiên bản NukeViet trước revision 734, các theme không phải của hệ thống khi nâng cấp lên phiên bản cao hơn cần chú ý: 
- - Mở file themes/ten_theme_admin/theme.php, tìm đến dòng gần cuối cùng: 
-<code php> 
-$xtpl->out( 'main' ); 
-</code> 
-Thay bằng: 
-<code php> 
-return $xtpl->text( 'main' ); 
-</code> 
- - Mở file themes/ten_theme/theme.php, tìm đến dòng gần cuối cùng: 
-<code php> 
-echo $sitecontent; 
-Thay bằng: 
-<code php> 
-echo $sitecontent; 
-</code> 
- - Gọi thêm biến global $client_info cho function  nv_site_theme trong file theme.php.\\ 
- - Trong file theme.php thay dòng: 
-<code php> 
-$xtpl->assign( 'THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");" ); 
-</code> 
-Bằng dòng: 
-<code php> 
-$xtpl->assign( 'THEME_SEARCH_SUBMIT_ONCLICK', "nv_search_submit('topmenu_search_query', 'topmenu_search_checkss', 'topmenu_search_submit', " . NV_MIN_SEARCH_LENGTH . ", " . NV_MAX_SEARCH_LENGTH . ");" ); 
-$xtpl->assign( 'CHECKSS', md5( $client_info['session_id'] . $global_config['sitekey'] ) );  
-</code> 
- - Trong /themes/default/layout/header.tpl thay dòng (nếu có): 
-<code php> 
-<form action="" method="get" class="search fr" onsubmit="return {THEME_SEARCH_SUBMIT_ONCLICK}"> 
-</code> 
-Bằng dòng: 
-<code php> 
-<form action="{NV_BASE_SITEURL}" method="get" class="search fr" onsubmit="return {THEME_SEARCH_SUBMIT_ONCLICK}"> 
-<input type="hidden" id="topmenu_search_checkss" value="{CHECKSS}" />  
-</code> 
programming4/note.1466122526.txt.gz · Sửa đổi lần cuối: 2016/06/17 07:15 bởi hoaquynhtim99