소스 검색

Add _p.web_url variable in twig template BT#13169

jmontoyaa 7 년 전
부모
커밋
b092665a78
2개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      main/inc/lib/api.lib.php
  2. 1 0
      main/inc/lib/template.lib.php

+ 12 - 0
main/inc/lib/api.lib.php

@@ -8186,3 +8186,15 @@ function location($url, $exit = true)
         exit;
     }
 }
+
+/**
+ * @return string
+ */
+function api_get_web_url()
+{
+    if (api_get_setting('server_type') == 'test') {
+        return api_get_path(WEB_PATH).'web/app_dev.php/';
+    } else {
+        return api_get_path(WEB_PATH).'web/';
+    }
+}

+ 1 - 0
main/inc/lib/template.lib.php

@@ -530,6 +530,7 @@ class Template
     {
         return [
             'web' => api_get_path(WEB_PATH),
+            'web_url' => api_get_web_url(),
             'web_relative' => api_get_path(REL_PATH),
             'web_course' => api_get_path(WEB_COURSE_PATH),
             'web_main' => api_get_path(WEB_CODE_PATH),