Skip to content

Ghi chú phát triển module download 4.0.30

Tan Dung Phan edited this page Sep 15, 2016 · 3 revisions

Thêm chức năng share qua cổng AddThis

INSERT INTO `nv4_vi_download_config` (`config_name`, `config_value`) VALUES ('shareport', 'none'), ('addthis_pubid', '');

Nếu giao diện sử dụng có module download thì:

Nếu tồn tại file themes/ten-theme/modules/download/theme.php, mở nó, tìm vị trí hàm view_file. Bên trong hàm thêm vào vị trí thích hợp đoạn

    if ($download_config['shareport'] == 'addthis') {
        $xtpl->assign('ADDTHIS_PUBID', $download_config['addthis_pubid']);
        $xtpl->parse('main.addthis');
    }

Nếu tồn tại file themes/ten-theme/modules/download/viewfile.tpl, mở nó tìm

<h2 class="m-bottom">{ROW.title}</h2>

Hoặc tương đương thêm vào sau

    <!-- BEGIN: addthis -->
    <div class="m-bottom clearfix">
        <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid={ADDTHIS_PUBID}"></script>
        <div class="addthis_sharing_toolbox"></div>
    </div>
    <!-- END: addthis -->

Thêm chức năng xử lý phần xem trực tuyến

INSERT INTO `nv4_vi_download_config` (`config_name`, `config_value`) VALUES ('pdf_handler', 'filetmp');

Hai giá trị:

  • filetmp
  • base64