housenav.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. $module = Yii::$app->controller->action->id;;
  3. if (!empty(Yii::$app->request->get('hid'))) {
  4. $name = \common\models\House::findOne(Yii::$app->request->get('hid'))['name'];
  5. $housenews = (new \common\models\News())->getHouseNews($name, 1);
  6. }
  7. ?>
  8. <!-- 导航 -->
  9. <div class="hu_nav" id="wdemo07">
  10. <div class="hu_nav_main scroller">
  11. <ul class="c clearfix">
  12. <li>
  13. <a href="/house/<?= $hid ?>">
  14. <span><?= \common\fm\Opencc::ConvertHn('楼盘首页') ?></span>
  15. <i></i>
  16. </a>
  17. </li>
  18. <li <?php if (strpos($_SERVER['REQUEST_URI'], 'house/details') > 0) echo 'class="on"' ?>>
  19. <a href="/house/details/<?= $hid ?>">
  20. <span><?= \common\fm\Opencc::ConvertHn('详情') ?></span>
  21. <i></i>
  22. </a>
  23. </li>
  24. <?php if (!empty($housenews)) { ?>
  25. <li <?php if (strpos($_SERVER['REQUEST_URI'], 'house/news') > 0) echo 'class="on"' ?>>
  26. <a href="/house/news/<?= $hid ?>">
  27. <span><?= \common\fm\Opencc::ConvertHn('动态') ?></span>
  28. <i></i>
  29. </a>
  30. </li>
  31. <?php } ?>
  32. <li <?php if (strpos($_SERVER['REQUEST_URI'], 'house/album') > 0) echo 'class="on"' ?>>
  33. <a href="/house/album/<?= $hid ?>">
  34. <span><?= \common\fm\Opencc::ConvertHn('相册') ?></span>
  35. <i></i>
  36. </a>
  37. </li>
  38. <li <?php if (strpos($_SERVER['REQUEST_URI'], 'house/type') > 0) echo 'class="on"' ?>>
  39. <a href="/house/type/<?= $hid ?>">
  40. <span><?= \common\fm\Opencc::ConvertHn('户型') ?></span>
  41. <i></i>
  42. </a>
  43. </li>
  44. </ul>
  45. </div>
  46. </div>
  47. <script>
  48. /**
  49. * 动态加载JS
  50. * url JS路径
  51. * callback 回调函数
  52. */
  53. function dynamicLoadJs(url, callback) {
  54. var head = document.getElementsByTagName('head')[0];
  55. var script = document.createElement('script');
  56. script.type = 'text/javascript';
  57. script.src = url;
  58. if (typeof (callback) == 'function') {
  59. script.onload = script.onreadystatechange = function () {
  60. if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") {
  61. callback();
  62. script.onload = script.onreadystatechange = null;
  63. }
  64. };
  65. }
  66. head.appendChild(script);
  67. }
  68. // 调用方法
  69. // dynamicLoadJs('/js/menu/lpnav.js',function(){});
  70. </script>