Tiaxgame.Tk
Trang chủ | Register Wap4.Co Free
Đăng Nhập » Đăng Ký
ForumWap4 Việt NamShare Code
Lượt xem: 304

▼ mã nguồn tự động tạo sitemap cho wap4 (twig)

* Emperor  (Member) [Off]
40 * 34
*   Cách đây 5 tháng
chả biết hướng dẫn thế nào, yaoming
demo:
bài viết tại:
dán vào file footer
{% set url=get_uri_segments() %}
{% set cpanel=get_data('cpanel')[0].data|json_decode %}
{%set link='http://taigamedi.com/'~url|join('/') %}
{% set list %} {% set data=get_data('sitemap')[0].data|json_decode %}{{data.list}}{% if cpanel.sitemap>0 %} {% for i in 1..cpanel.sitemap %} {% set data1=get_data('site'~i)[0].data|json_decode %}{{data1.list}}{% endfor %}{% endif %}{% endset %}
{% set list=list~'' %}
{% if link~'-_-' in list %}{% else %}
{% set site1=get_data('sitemap')[0].data|json_decode %}
{% if site1.total<151 %}
{{update_data_by_id('sitemap',get_data('sitemap')[0].id,{"total":site1.total+1,"list":link~'-_-'~title~'-_-'~'0.'~random(100)~'_-_'~site1.list}|json_encode)}}
{% else %}
{% set site1=get_data('sitemap'~cpanel.sitemap)[0].data|json_decode %}
{% if site1.total<151 %}
{{update_data_by_id('sitemap'~cpanel.sitemap,get_data('sitemap'~cpanel.sitemap)[0].id,{"total":site1.total+1,"list":link~'-_-'~title~'-_-'~'0.'~random(100)~'_-_'~site1.list}|json_encode)}}
{% else %}
{% set p=cpanel.sitemap+1 %}
{{save_data('sitemap'~p,{"total":1,"list":link~'-_-'~title~'-_-'~'0.'~random(100)~'_-_'}|json_encode)}}
{{update_data_by_id('cpanel',get_data('cpanel')[0].id,{"title":cpanel.title,"desc":cpanel.desc,"keys":cpanel.keys,"img":cpanel.img,"favicon":cpanel.favicon,"url":cpanel.url,"sitemap":cpanel.sitemap+1,"tiento":cpanel.tiento,"css":cpanel.css}|json_encode)}}
{% endif %}
{% endif %}

{% endif %}

Tạo file: sitemap.xml . dán vào file sitemap.xml với nội dung sau
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
{% set data=get_data('sitemap')[0].data|json_decode %}{% set list=data.list %}{% set cpanel=get_data('cpanel')[0].data|json_decode %}{% if cpanel.sitemap>0 %} {% set list %}{% for i in 1..cpanel.sitemap %} {% set zink=get_data('sitemap'~i)[0].data|json_decode %}{{data.list}}{{zink.list}}{% endfor %}{% endset %}{% endif %}
{% set list=list~'' %}
{% set total=data.total-1 %} {% if cpanel.sitemap>0 %}{% set site1=get_data('sitemap'~cpanel.sitemap)[0].data|json_decode %} {% set total=150*cpanel.sitemap+site1.total-cpanel.sitemap-1 %} {% endif %}
{% for i in 0..total %}{% set list1=list|split('_-_')[i] %}
{% set zink %}<url>
<loc>{{list1|split('-_-')[0]}}</loc>
<changefreq>daily</changefreq>
<priority>{{list1|split('-_-')[2]}}</priority>
</url>{% endset %}{{sad}}{% endfor %}
</urlset>

B3: tạo một data key: sitemap. nội dung là: zink đẹp trai.
ok rồi đó
Edited by: Emperor
[Like=1] Pupy
* Emperor  (Member) [Off]
40 * 34
*   Cách đây 5 tháng
code sau khi hiển thị là như sau
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>http://taigamedi.com/index</loc>
<changefreq>daily</changefreq>
<priority>0.2</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/share-code.html</loc>
<changefreq>daily</changefreq>
<priority>0.83</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/lam-van-mau.html</loc>
<changefreq>daily</changefreq>
<priority>0.17</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/thu-thuat-cho-android.html</loc>
<changefreq>daily</changefreq>
<priority>0.99</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/mat-ngu-12-chom-sao.html</loc>
<changefreq>daily</changefreq>
<priority>0.83</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/hoc-nau-an-don-gian.html</loc>
<changefreq>daily</changefreq>
<priority>0.25</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/chu-de-miui.html</loc>
<changefreq>daily</changefreq>
<priority>0.66</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/ma-giam-gia.html</loc>
<changefreq>daily</changefreq>
<priority>0.35</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/blog-truyen.html</loc>
<changefreq>daily</changefreq>
<priority>0.43</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/ung-dung.html</loc>
<changefreq>daily</changefreq>
<priority>0.83</priority>
</url><url>
<loc>http://taigamedi.com/mien-phi/tai-game.html</loc>
<changefreq>daily</changefreq>
<priority>0.6</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/quy-dinh-dien-dan-taigamedi-com.html</loc>
<changefreq>daily</changefreq>
<priority>0.19</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/chom-sao-khong-de-dang-noi-ra-noi-tam-cua-minh.html</loc>
<changefreq>daily</changefreq>
<priority>0.14</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/khi-cam-thay-qua-co-don-12-chom-sao-se-lam-gi-de-vuot-qua.html</loc>
<changefreq>daily</changefreq>
<priority>0.30</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/xep-hang-si-tinh-cua-12-chom-sao.html</loc>
<changefreq>daily</changefreq>
<priority>0.4</priority>
</url><url>
<loc>http://taigamedi.com/index/5</loc>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/cac-chom-sao-cang-ve-gia-cang-hanh-phuc.html</loc>
<changefreq>daily</changefreq>
<priority>0.53</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/nhin-chung-cuoc-doi-cua-12-chom-sao-ai-co-phuc-nhat.html</loc>
<changefreq>daily</changefreq>
<priority>0.78</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/phong-van-nhanh-12-chom-sao-ban-muon-ong-gia-noel-tang-qua-gi-vao-dip-giang-sinh-nam-nay.html</loc>
<changefreq>daily</changefreq>
<priority>0.76</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/ai-muon-khoc-ma-nuoc-mat-cu-chay-vao-trong.html</loc>
<changefreq>daily</changefreq>
<priority>0.99</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/khoc-1-minh-khong-de-nguoi-khac-biet.html</loc>
<changefreq>daily</changefreq>
<priority>0.18</priority>
</url><url>
<loc>http://taigamedi.com/index/4</loc>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/nguyen-nhan-12-chom-sao-dac-toi-voi-nguoi-khac.html</loc>
<changefreq>daily</changefreq>
<priority>0.56</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/sao-nao-tu-luc-sinh-ra-da-co-quy-nhan-phu-tro.html</loc>
<changefreq>daily</changefreq>
<priority>0.38</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/khi-12-chom-sao-doi-mat-voi-su-that-bai.html</loc>
<changefreq>daily</changefreq>
<priority>0.10</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/so-sanh-giua-g2-g3-g4-v10-may-nao-chien-game-ngon-nhat.html</loc>
<changefreq>daily</changefreq>
<priority>0.2</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/cach-mo-flappy-android-goi-vay-vi-giong-flappy-bird-cho-moi-may-android.html</loc>
<changefreq>daily</changefreq>
<priority>0.56</priority>
</url><url>
<loc>http://taigamedi.com/index/3</loc>
<changefreq>daily</changefreq>
<priority>0.36</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/con-duong-anh-chon.html</loc>
<changefreq>daily</changefreq>
<priority>0.93</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/toi-va-ban.html</loc>
<changefreq>daily</changefreq>
<priority>0.92</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/tinh-dau-cua-mot-con-be-cap-hai.html</loc>
<changefreq>daily</changefreq>
<priority>0.18</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/neu-con-trong-bung-giong-anh.html</loc>
<changefreq>daily</changefreq>
<priority>0.53</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/la-duyen-phan-hay-vi-anh-tim-em.html</loc>
<changefreq>daily</changefreq>
<priority>0.81</priority>
</url><url>
<loc>http://taigamedi.com/index/2</loc>
<changefreq>daily</changefreq>
<priority>0.53</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/se-co-nguoi-can-em.html</loc>
<changefreq>daily</changefreq>
<priority>0.6</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/neu-bong-dung-ta-chan-nhau.html</loc>
<changefreq>daily</changefreq>
<priority>0.50</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/cau-tuyet-doi-khong-duoc-xay-ra-chuyen-gi-day.html</loc>
<changefreq>daily</changefreq>
<priority>0.56</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/khi-hanh-phuc-di-qua.html</loc>
<changefreq>daily</changefreq>
<priority>0.66</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/truyen-hay-cafe-buon.html</loc>
<changefreq>daily</changefreq>
<priority>0.83</priority>
</url><url>
<loc>http://taigamedi.com/tai-game/vi-tinh-yeu.html</loc>
<changefreq>daily</changefreq>
<priority>0.20</priority>
</url><url>
<loc>http://taigamedi.com/</loc>
<changefreq>daily</changefreq>
<priority>0.51</priority>
</url></urlset>
[Like=2] TPNo1 , Pupy
* TPNo1  (Member) [Off]
20 * 29
*   Cách đây 5 tháng
Like. Tuy k hỉu rì cả :D
* Kingsman  (Member) [Off]
2 * 0
*   Cách đây 4 tháng
Tạo file: sitemap.xml . dán vào file sitemap.xml với nội dung sau
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
{% set data=get_data('sitemap')[0].data|json_decode %}{% set list=data.list %}{% set cpanel=get_data('cpanel')[0].data|json_decode %}{% if cpanel.sitemap>0 %} {% set list %}{% for i in 1..cpanel.sitemap %} {% set zink=get_data('sitemap'~i)[0].data|json_decode %}{{data.list}}{{zink.list}}{% endfor %}{% endset %}{% endif %}
{% set list=list~'' %}
{% set total=data.total-1 %} {% if cpanel.sitemap>0 %}{% set site1=get_data('sitemap'~cpanel.sitemap)[0].data|json_decode %} {% set total=150*cpanel.sitemap+site1.total-cpanel.sitemap-1 %} {% endif %}
{% for i in 0..total %}{% set list1=list|split('_-_')[i] %}
{% set zink %}<url>
<loc>{{list1|split('-_-')[0]}}</loc>
<changefreq>daily</changefreq>
<priority>{{list1|split('-_-')[2]}}</priority>
</url>{% endset %}{{zink}}{% endfor %}
</urlset>
* solovekui  (Member) [Off]
35 * 30
*   Cách đây 2 tháng
Gửi từ Emperor:
chả biết hướng dẫn thế nào, :yaoming: demo: http://taigamedi.com/sitemap.xml bài viết tại: http://taigamedi.com/tai-game/ma-nguon-tu-dong-tao-sitemap-cho-wap4-twig.html dán vào file footer [code]{ ...
Code lỗi
▼ Tổng số: 5
- Share:
BBCode:

Link: