• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Share xtscript xử lý link youtube

Admin

Well-Known Member
Staff member
Administrator
HTML:
<!--parser:xtscript-->
function youtube $link=http://m.youtube.com/watch?hl=vi&client=mv-google&gl=US&v=vkWwEgZrbmc;
var $i = <xt:get_device_template />
if $i==web
var $h = 375
var $w = 500
else
var $h = 180
var $w = 240
endif
var $l = call strlen $val=$link
if $l == 11
var $id = $link
else
var $start = call strpos $haystack=$link;$needle=v=;
var $start = ($start+2)
var $id = call substr $val=$link;$start=$start;$length=11;
endif
print <div class="video"><object type='application/x-shockwave-flash' data='http://www.youtube.com/v/$id' width='$w' height='$h'> <param name='movie' value='http://www.youtube.com/v/$id' /> <param name='quality' value='default' /><param name='allowFullScreen' value='true' /> <!-- Fallback content --><a onclick='_gaq.push(['_trackEvent', 'Outgoing', 'www.youtube.com', '/watch?v=$id'])' href='$link'> YouTube Video:<br /><img src='http://img.youtube.com/vi/$id/0.jpg' width='$w' height='$h' alt='Click here to view on youtube' /></a></object></div>
endfunction
<!--/parser:xtscript-->
SD:
HTML:
<!--parser:xtscript-->
call youtube $link=link youtube
<!--/parser:xtscript-->
or
HTML:
<xt:call function="youtube" link="link youtube">

Dùng link mobile hoặc id cũng ok
Demo v-star.wap.sh

Demo áp dụng làm bbcode cho xtblog: Larva - Laughing (****)|Blog|2|v-star.wap.sh

Lưu ý:
- include thì dùng call @youtube
- Không nên dùng include vì sẽ tăng thời gian xử lý của server => lag. (inc: 5x-7x, không inc: 0x-1x)
Nguồn: V-STAR
 

Facebook Comments

Similar threads

New posts New threads New resources

Back
Top