Document.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * 系统文章
  4. */
  5. namespace app\home\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. * ============================================================================
  10. *
  11. * ============================================================================
  12. *
  13. * ----------------------------------------------------------------------------
  14. *
  15. * ============================================================================
  16. * 控制器
  17. */
  18. class Document extends BaseMall {
  19. public function initialize() {
  20. parent::initialize();
  21. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/index.lang.php');
  22. }
  23. public function index() {
  24. $code = input('param.code');
  25. if ($code == '') {
  26. $this->error(lang('param_error'));//'缺少参数:文章标识'
  27. }
  28. $document_model = model('document');
  29. $doc = $document_model->getOneDocumentByCode($code);
  30. View::assign('doc', $doc);
  31. /**
  32. * 分类导航
  33. */
  34. $nav_link = array(
  35. array(
  36. 'title' => lang('homepage'),
  37. 'link' => HOME_SITE_URL
  38. ),
  39. array(
  40. 'title' => $doc['document_title']
  41. )
  42. );
  43. View::assign('nav_link_list', $nav_link);
  44. return View::fetch($this->template_dir . 'index');
  45. }
  46. }