- Tham gia
- 28/02/2015
- Bài viết
- 16,197
- Được Like
- 12,546
SVG Template - Template SVG cho XenForo 2 2.2.2
Tùy thuộc vào cấu hình, add-on này đòi hỏi máy chủ web hỗ trợ URL rewrite!
Cho phép hình ảnh SVG (Scalable Vector Graphics) được lưu trữ dưới dạng template. Điều này tạo ra một tập tin svg.php mới trong thư mục gốc XF.
Để tạo một liên kết đến một template SVG (Template phải có
Dưới Board information, nếu "Use Full Friendly URLs" (useFriendlyUrls) được thiết lập thì URL được tạo ra là:
Nếu không thì
Cấu hình Nginx URL rewrite
Cấu hình Apache URL rewrite
Thêm quy tắc trước
tức là, nên trông tương tự như;
Chúc các bạn thành công.
Tùy thuộc vào cấu hình, add-on này đòi hỏi máy chủ web hỗ trợ URL rewrite!
Cho phép hình ảnh SVG (Scalable Vector Graphics) được lưu trữ dưới dạng template. Điều này tạo ra một tập tin svg.php mới trong thư mục gốc XF.
Để tạo một liên kết đến một template SVG (Template phải có
.svg
ở cuối tên!);
Mã:
{{ getSvgUrl('tempate.svg') }}
Dưới Board information, nếu "Use Full Friendly URLs" (useFriendlyUrls) được thiết lập thì URL được tạo ra là:
Mã:
/data/svg/<style_id>/<langauge_id>/<style_last_modified>/<templateName.svg>
Nếu không thì
Mã:
svg.php?svg=<templateName>&s=<style_id>&l=<langauge_id>&d=<style_last_modified>
Cấu hình Nginx URL rewrite
Mã:
location ^~ /data/svg/ {
access_log off;
rewrite ^/data/svg/([^/]+)/([^/]+)/([^/]+)/([^\.]+).svg$ /svg.php?svg=$4&s=$1&l=$2&d=$3$args last;
return 403;
}
Cấu hình Apache URL rewrite
Thêm quy tắc trước
data/
tham chiếu cuối cùng;
Mã:
RewriteRule ^data/svg/([^/]+)/([^/]+)/([^/]+)/([^\.]+).svg$ svg.php?svg=$4&s=$1&l=$2&d=$3 [B,NC,L,QSA]
tức là, nên trông tương tự như;
Mã:
# If you are having problems with the rewrite rules, remove the "#" from the
# line that begins "RewriteBase" below. You will also have to change the path
# of the rewrite to reflect the path to your XenForo installation.
#RewriteBase /xenforo
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^data/svg/([^/]+)/([^/]+)/([^/]+)/([^\.]+).svg$ svg.php?svg=$4&s=$1&l=$2&d=$3 [B,NC,L,QSA]
RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Chúc các bạn thành công.
Nguồn: xenforo.com