
Admin
Well-Known Member
Staff member
Administrator
Demo: http://wmvn.hexat.com/menu/blog.html?__xtblog_entry=505178c033cfe36843000001#xt_blog (viewsource mới hiểu)
Code này mình làm nó sẽ tự động get thẻ meta keywords, description . Đảm bảo chuẩn và hợp lệ cho anh em
Đặt code trên vào giữa cặp thẻ <head>...</head>
Code này mình làm nó sẽ tự động get thẻ meta keywords, description . Đảm bảo chuẩn và hợp lệ cho anh em
HTML:
<!--parser:xtscript-->
var $blog = <xt:blog tzone="7" display="1" entries_per_page="10" comments_per_page="20" comments_sort="-1" display_limit="50" display_symbol="..." version="2" t_back_to_posts="" t_comments="" t_post_a_comment="" t_name="" t_comment="" t_post="" />
var $daut = call strrpos $haystack=$blog;$needle=<div class="xt_blog_content">
var $cuoit = call strrpos $haystack=$blog;$needle=</div>
if $daut > 0
var $noidung = call substr $val=$blog;$start=($daut+29);$length=($cuoit-29-$daut)
var $des = call substr $val=$noidung;$start=0;$length=136
var $des = call strip_tags $val=$des
var $des = call htmlspecialchars $val=$des
var $spc = call chr $val=32
var $key = call str_replace $subject=$des;$search=$spc;$replace=,
var $key = call str_replace $subject=$key;$search=.;$replace=,
endif
print <meta name="description" content="$des" /><meta name="keywords" content="$key" />
<!--/parser:xtscript-->