Addon 2x SVG Template - Template SVG cho XenForo 2 2.2.2

PVS

Super Moderator
Thành viên BQT
Tham gia
28/02/2015
Bài viết
16,829
Được Like
12,687
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ó .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​
 

Đính kèm

  • addon-Xon-SvgTemplate-2.2.2.zip
    20.9 KB · Lượt xem: 8

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mobile/Zalo: 0906081284

Telegram: anhanhxf

Chỉ nhận web nội dung lành mạnh

Nhà Tài Trợ

Mút Xốp Không Gian
Mút Sofa Không Gian
Top Bottom