>

Tạo file kenh youtube

+ Thêm Mã HTML

HTML
  1. <!-- Latest compiled and minified CSS -->
  2. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">


+ Thêm mã twig:

TWIG
  1. {%macro youtube(msg,i=0)%}
  2. {%if msg is not empty%}
  3. {%set cat=msg|split('[cat]')[1]|split('[/cat]')[0]%}
  4. {%set uid=msg|split('[uid]')[1]|split('[/uid]')[0]%}
  5. {%set sdate=msg|split('[sdate]')[1]|split('[/sdate]')[0]%}
  6. {%set name=msg|split('[name]')[1]|split('[/name]')[0]%}
  7. {%set url=msg|split(')[1">|split(']')[1]|split('')[0]%}
  8. {%set more=msg|split('[more]')[1]|split('[/more]')[0]%}
  9. {%set status2%}
  10. <div class="list2 left">Tên: {{name|raw}}</div>
  11. <div class="list1 left">
  12. <div class="row">
  13. <div class="col-md-2" style="text-align:left">
  14. <a href="/main.php?f=3475305&yid={{url|split('v=')[1]}}"><img src="http://img.youtube.com/vi/{{url|split('v=')[1]}}/mqdefault.jpg" style="border: 1px solid #AFAFAF; padding: 1px; border-radius: 5px; box-shadow: 0px 0px 3px 1px #C5B8B8;max-width: 100%;"/></a>
  15. </div>
  16. <div class="col-md-10" style="text-align:left">
  17. {{i+1}}. Mô tả: {{thaian2009.shoutbox(more)|raw}}
  18. <div style="text-align:right;color:gray">Đăng bởi: {{api.u.get(uid).nick}}<br/><small>Ngày đăng: {{sdate}}</small></div>
  19. </div>
  20. </div>
  21. </div><div class="shadow"></div>
  22. {%endset%}
  23. {%if api.r.get('search') is not empty%}{%set skey=api.r.get('type')%}{%set ssearch=api.r.get('search')%}{%if (skey=='nick' and ssearch==api.u.get(uid).nick) or (skey=='title' and ssearch in ('!'~name)) or (skey=='body' and ssearch in ('!'~more)) or (skey=='date' and ssearch in ('!'~sdate))%}{{status2}}{%endif%}{%elseif api.r.get('search') is empty%}{{status2}}{%endif%}
  24. {%endif%}
  25. {%endmacro%}
  26. {%macro content(msg,del)%}{{msg}}{{del}}[-msS-]{%endmacro%}
  27. {%import _self as youtube%}
  28. {%set sdata=''%}
  29. {{_self.env.addGlobal('youtube',youtube)}}
  30. {{_self.env.addGlobal('sdata',sdata)}}



Thay 3475305 thành id file Xem youtube

+ Thêm shoutbox history

Ô 1:


TWIG
  1. {%set msg=message_list|split('[-msS-]')%}
  2. {%set sdata=_self.env.getGlobals()['sdata']%}
  3. {%set sdata=sdata~message_list%}{{_self.env.addGlobal('sdata',sdata)}}
  4. {%set surl=_self.env.getGlobals()['surl']%}
  5. {%if msg|length>=99%}
  6. {%if surl is empty%}
  7. {%set url=''%}
  8. {%else%}
  9. {%set url=surl%}
  10. {%endif%}
  11. {%else%}
  12. {%if surl is not empty%}
  13. {%set url=surl%}
  14. {%else%}
  15. {%set url=form_url%}
  16. {%endif%}
  17. {%endif%}
  18. {{_self.env.addGlobal('surl',url)}}



Ô 2:

TWIG
  1. {{youtube.content(message,delete_post_button)}}


+ Thêm mã twig

TWIG
  1. <div class="titles">Đăng lên youtube mới</div>
  2. <div class="list2 left">
  3. {%if api.r.getMethod()=='GET' and api.r.get('them') is empty%}<a href="main.php?f={{api.r.get('f')}}&them=ok">Thêm video youtube mới</a>{%endif%}
  4. {%if api.r.getMethod()=='GET' and api.r.get('them')=='ok'%}
  5. <form method="post">
  6. Nhập Tên video<br/>
  7. <input type="text" name="name" value="{{api.r.get('name')}}"/><br/>
  8. Nhập địa chỉ video<br/>
  9. <input type="text" name="url" value="{{api.r.get('url')}}"/><br/>
  10. Ghi chú thích<br/>
  11. <textarea name="more">{{api.r.get('more')}}</textarea><br/>
  12. Chọn thể loại<br/>
  13. <select name="cat"><option value="0">Tất cả</option><option value="1">Phim hay</option><option value="2">Video nhạc</option><option value="3">Hài hước</option></select>
  14. <br/>
  15. <input type="submit" value="Thêm"/>
  16. </form>
  17. {%endif%}
  18. {%if api.r.getMethod()=='POST' and api.r.get('name') is not empty and api.r.get('url') is not empty%}
  19. Bạn vừa nhập vào Video có tên là {{api.r.get('name')}}. Bạn có muốn thêm vào bên dưới?<br/>
  20. <form action="{{_self.env.getGlobals()['surl']|replace({'them%3Don':''})|raw}}" method="post">
  21. <textarea name="text" style="display:none">[cat]{{api.r.get('cat')|default('0')}}[/cat][uid]{{api.user_id}}[/uid][sdate]{{'now'|date('d-m-Y')}}[/sdate][name]{{api.r.get('name')}}[/name]{{api.r.get('url')|replace({'http://':'','https://':''})|raw}}">{{api.r.get('url')|replace({'http://':'','https://':''})|raw}}[more]{{api.r.get('more')|default('null')}}[/more]</textarea>
  22. <input type="submit" value="Đồng ý thêm"/>
  23. </form>
  24. {%endif%}
  25. </div>
  26. <div class="titles">Tìm kiếm video</div>
  27. <div class="list2 left">
  28. <form method="get" action="main.php?"><input type="hidden" name="f" value="{{api.r.get('f')}}"/>
  29. Nhập từ khóa<br/>
  30. <input type="text" name="search" value="{{api.r.get('search')}}"/><br/>
  31. Tìm theo <select name="type"><option value="nick">Người đăng</option><option value="title">Tên video</option><option value="body">Mô tả</option><option value="date">Ngày đăng</option></select><br/>
  32. <input type="submit" value="Tìm ngay"/>
  33. </form>
  34. </div>
  35.  
  36. {%set sdata=_self.env.getGlobals()['sdata']|split('[-msS-]')%}
  37.  
  38. {%set sotrang=7%}
  39. {%set spage=api.r.get("pusl")|default(0)%}
  40. {%if spage>0%}{%set dau=spage*sotrang%}{%set cuoi=((spage+1)*sotrang)-1%}{%else%}{%set dau=spage*sotrang%}{%set cuoi=((spage+1)*sotrang)-1%}{%endif%}
  41. <div class="titles">Danh sách youtube</div>
  42. {%for i in dau..cuoi if sdata|length>1%}{{youtube.youtube(sdata[i],i)|raw}}{%endfor%}
  43.  
  44.  
  45. <center>{%if spage>0%}<a href="main.php?{%if api.r.get('f')>=5%}f={{api.r.get('f')}}{%endif%}&pusl={%if spage==null%}1{%else%}{{spage-1}}{%endif%}#chatne"> &lt&lt;;Trang trước</a> | {%endif%}<a href="main.php?{%if api.r.get('f')>=5%}f={{api.r.get('f')}}{%endif%}&pusl={%if spage==null%}1{%else%}{{spage+1}}{%endif%}#chatne">Trang sau>></a></center>



+ Tạo file xem youtube

Thêm mã HTML

HTML
  1. <style type="text/css">
  2. body,html{background-color:#000 !important;}
  3. html{background-image:url(http://img.youtube.com/vi/{{api.r.get('yid')|default('GJ5kog1O9J4')}}/maxresdefault.jpg);background-size: cover;}
  4.  
  5. <script type="text/javascript">
  6. function goFullscreen(id) {
  7. var element = document.getElementById(id);
  8. if (element.mozRequestFullScreen) {
  9. element.mozRequestFullScreen();
  10. } else if (element.webkitRequestFullScreen) {
  11. element.webkitRequestFullScreen();
  12. }
  13. }
  14. <style type='text/css'>
  15. .player:-webkit-full-screen {
  16. width: 100%;
  17. height: 100%;
  18. }
  19. .player:-moz-full-screen {
  20. width: 100%;
  21. height: 100%;
  22. }
  23. .buom{margin-top:-470px}
  24. </style>



+ Thêm mã twig


TWIG
  1. <div class="list2"><b><a href="javascript: void(0)" onclick="player.playVideo()">Phát video</a> | <a href="javascript: void(0)" onclick="player.pauseVideo()">Dừng video</a> | <a href="javascript: void(0)" onclick="goFullscreen('player');">Full screen</a></b></div>
  2.  
  3. <center id="player"><div id="ytplayer"></div></center>
  4. <script>
  5. var tag = document.createElement('script');
  6. tag.src = "https://www.youtube.com/player_api";
  7. var firstScriptTag = document.getElementsByTagName('script')[0];
  8. firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  9. var player;
  10. function onYouTubePlayerAPIReady() {
  11. player = new YT.Player('ytplayer', {
  12. height: '390',
  13. width: '640',
  14. videoId: '{{api.r.get('yid')|default('GJ5kog1O9J4')}}',playerVars: { 'autoplay': 0, 'controls': 0 ,'start':0,theme:'dark','autohide':1,'loop':-1}
  15. });
  16. }
  17.  
  18. </script>
  19. <marquee>
  20. {%for i in 1..3%}
  21. <img src="http://img.youtube.com/vi/{{api.r.get('yid')|default('GJ5kog1O9J4')}}/{{i}}.jpg"/>
  22. {%endfor%}
  23. </marquee>
  24.  
  25. <embed class="buom" src="/files/1083055/51.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="500"></embed>



Nguồn: http://chonguoivotinh.wap.mu

Demo: http://chonguoivotinh.wap.mu/m ... 73339

DMCA.com Protection Status
Cùng Chuyên Mục
Xem thêm
Comment
Tên bạn
Nội dung


Bình luận rỗng.

Close

ảnh cm Contact Facebook
ảnh cm Contact Google+
ảnh cm Blog Trương Minh Đức
Facebook Google+ YouTube
Được tài trợ bởi