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

▼ Share Chức năng Blog cho forum tiaxgame

* Ivoryss  (Member) [Off]
30 * 33
*   Cách đây 2 tháng
Chào anh em nay mình xin mạnh dạn nhấn mạnh share chức năng Blog

Chức năng

Đăng blog (riêng tư ,bạn bè, mọi người)

- thích blog , xóa blog của mình

- đăng blog trên cá nhân người khác sẽ là dạng gắn thẻ

- cách dùng


Tạo file blog

Tạo data

key blog_chat
data []

Key blog_comment_~tên nick ở đây

Data []

Hoặc ae dùng get data count if==0 save nha

Dán đoạn js sau vô

<script type="text/javascript">
$("#blueimp-gallery").on("open",function(e){}).on("opened",function(e){}).on("slide",function(e,t,n){}).on("slideend",function(e,t,n){}).on("slidecomplete",function(e,t,n){}).on("close",function(e){}).on("closed",function(e){});$(document).ready(function(){jQuery.ias({container:".timeline",item:".timeline_item",trigger:"Xem thêm nhé, còn nhiều lắm ^^",pagination:".navigation",next:".next-posts a",loader:'<img src="http://my.teamobi.com/beta/app/view/source/css/loading.gif"/>',triggerPageThreshold:2})});$(document).on("click",".submitcomment",function(){var e=$(this);var t=e.attr("id");var n=$("#comment_"+t).val();var r="comment="+n+"&post_id="+t;if(n==""){alert("Vui lòng nhập bình luận")}else{$("#flash").show();$("#flash").fadeIn(400).html('<img src="http://my.teamobi.com/beta/app/view/source/css/loading.gif" height="50px" />');$.ajax({type:"POST",url:"/blog?do=post",data:r,cache:false,success:function(e){$("ul#update_"+t).prepend(e);document.getElementById("comment_"+t).value="";$("#flash").hide()}})}return false})
</script>
<script type="text/javascript" >

$(document).on("click",".follow",function(){
var element = $(this);
var I = element.attr("id");
var info = 'id=' + I;
$("#loading"+I).show();
$("#loading"+I).html('<img src="http://my.teamobi.com/beta/app/view/source/css/loading.gif" height="15px" >');

$.ajax({
type: "POST",
url: "/forums/like.html",
data: info,
success: function(e){
$("#loading"+I).ajaxComplete(function(){}).hide();
$('#follow'+I).fadeOut(200).hide();
$('#remove'+I).fadeIn(200).show();
$("#text_like"+I).html(e);
}
});
return false;
});
</script>

<script type="text/javascript" >
$(document).on("click",".remove",function(){
var element = $(this);
var I = element.attr("id");
var info = 'id=' + I;
$("#loading"+I).show();
$("#loading"+I).html('<img src="http://my.teamobi.com/beta/app/view/source/css/loading.gif" height="15px" >');

$.ajax({
type: "POST",
url: "/forums/unlike.html",
data: info,
success: function(e){
$("#loading"+I).ajaxComplete(function(){}).hide();
$('#remove'+I).fadeOut(200).hide();
$('#follow'+I).fadeIn(200).show();
$("#text_like"+I).html(e);
}
});
return false;
});
</script>
<script type="text/javascript" >
$(document).on("click",".removecm",function(){

var element = $(this);
var I = element.attr("id");

var info = 'id=' + l;
$.ajax({
type: "POST",
url: "/blog/delete-cm/",
data: info,
success: function(e){
$('#comment_'+I).fadeOut(200).hide();
}
});
return false;
});

</script>
<script type="text/javascript" >
$(document).on("click",".report",function(){
var element = $(this);
var I = element.attr("id");
var info = 'id=' + I;
//$("#loading"+I).show();
//$("#loading"+I).html('<img src="http://my.teamobi.com/beta/app/view/source/css/loading.gif" height="15px" >');
$.ajax({
type: "POST",
url: "/forums/report.html",
data: info,
success: function(e){
//$("#loading"+I).ajaxComplete(function(){}).hide();
$('#report'+I).fadeOut(200).hide();
$('#areport'+I).fadeIn(200).show();
//$("#text_like"+I).html(e);
}
});
return false;
});
</script>



Hình ảnh của chức năng
[Hình ảnh]


Dán vô tiếp file blog

{%use "_blocks"%}


{%set uri=get_uri_segments()%}
{%import "function.twig" as k%}
{%set sign=k.login()|trim%}

{%if sign%}

{{block("beta")}}


{#comment blog#}



{%if get_get("do")=="post" %}

{%if get_post("comment")!="" and get_post("post_id")!=""%}

{#<script>document.location=""</script>#}
{{k.add("blog_chat","blog_"~(k.get("info","dem_blog")|trim+1)~"_"~get_post("post_id"),{"nick":k.login()|trim,"msg":get_post("comment"),"time":"now"|date("U"),"id_blog":get_post("post_id"),"id_chat":k.get("info","dem_blog")|trim+1})}}


{{k.up("blog_list_chat",""~(k.get("info","dem_blog")|trim+1)~"-"~get_post("post_id"),"up")}}

{{k.add("info","dem_blog",k.get("info","dem_blog")|trim+1)}}
{%endif%}

{%else%}



{#xóa blog comment#}


{%if uri[1]=="delete-cm" and get_get("id") and get_get("postid") and sign==get_data("blog_chat")[0].data|json_decode["blog_"~get_get("id")~"_"~get_get("postid")]["nick"] and sign%}




{%set data=get_data("blog_chat")[0].data|json_decode["blog_"~get_get("id")~"_"~get_get("postid")]%}
<script>document.location="/blog/{{sign}}"</script>
{{k.delarray("blog_chat","blog_"~(get_get("id")~"_"~get_get("postid")))}}

{{k.del("blog_list_chat",get_get("id")~"-"~get_get("postid"),"up")}}
{%else%}




{%set ikk=get_data("blog_comment_"~sign)[0].data|json_decode["list_blog_"~uri[2]]%}

{%if uri[1]=="delete" and uri[2]|lower and sign==ikk["nick"] %}

<script>document.location="/blog/{{sign}}"</script>
{%if ikk["share"]%}{{k.delarray("blog_comment_"~ikk["share"],"list_blog_"~uri[2])}}{{k.delarray("blog_comment_"~sign,"list_blog_"~uri[2])}}
{{k.del("blog_"~ikk["share"],uri[2],"up")}}
{{k.del("blog_"~sign,uri[2],"up")}}
{%else%}
{{k.del("blog_"~sign,uri[2],"up")}}

{{k.delarray("blog_comment_"~sign,"list_blog_"~uri[2])}}
{%endif%}



{%for e in get_data("blog_list_chat")[0].data|split("@")%}
{%if loop.last==false %}
{%set e0=e|split("-")[0]|trim%}{%set e1=e|split("-")[1]|trim%}
{%set v_tt=get_data("blog_chat")[0].data|json_decode["blog_"~e0~"_"~uri[2]]%}
{%if sign==v_tt.nick%}
{{k.delarray("blog_chat","blog_"~e0~"_"~uri[2])}}
{{k.del("blog_list_chat",e0~"-"~uri[2],"up")}}
{%endif%}

{%endif%}
{%endfor%}

{%endif%}


{%if uri[1]|lower and k.get("user_"~uri[1]|lower,"nickk")%}
{%set ik=get_data("blog_comment_"~uri[1])[0].data|json_decode%}
{%set ik0=get_data("blog_comment_"~sign)[0].data|json_decode%}


{%if get_post("content")|trim|length<=2000 and get_post("content")|trim!="" and get_post("status") in ["1","2","3"] and get_post("status")!=""%}

{%if sign!=uri[1] %}

{#user!=login#}

{{k.up("blog_"~uri[1],(ik["dem"]|trim+1),"up")}}
{{k.up("blog_"~sign,(ik["dem"]|trim+1),"up")}}



{{k.add("blog_comment_"~uri[1],"list_blog_"~(ik["dem"]|trim+1),{"nick":sign,"nick2":uri[1],"content":get_post("content"),"blog_act":get_post("status"),"time":"now"|date("U"),"id":(ik["dem"]|trim+1),"share":uri[1]})}}

{{k.add("blog_comment_"~sign,"list_blog_"~(ik["dem"]|trim+1),{"nick":sign,"nick2":uri[1],"content":get_post("content"),"blog_act":get_post("status"),"time":"now"|date("U"),"id":(ik["dem"]|trim+1),"share":uri[1]})}}

{%else%}

{#user==login#}
{{k.add("blog_comment_"~uri[1],"list_blog_"~(ik["dem"]|trim+1),{"nick":sign,"nick2":uri[1],"content":get_post("content"),"blog_act":get_post("status"),"time":"now"|date("U"),"id":(ik["dem"]|trim+1)})}}

{{k.up("blog_"~sign,(ik["dem"]|trim+1),"up")}}
{%endif%}

{{k.add("blog_comment_"~uri[1],"dem",k.get("blog_comment_"~uri[1],"dem")|trim+1)}}
{{k.up("blog_"~uri[1],(ik["dem"]|trim+1),"up")}}
<script>document.location=""</script>

{{k.add("user_"~uri[1],"time_last_blog","now"|date("U"))}}

{%endif%}

<!--- end colll -->
<div class="col-lg-8">

<div >
<ul class="timeline links" id="links">
<li style="min-height: 156px;">
<div class="timeline-item" data-spy="affix" data-offset-top="300" >
<!-- The file upload form used as target for the file upload widget -->
<form action="" method="POST" enctype="multipart/form-data" >
<!-- Redirect browsers with JavaScript disabled to the origin page -->
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="row">
<div class="col-lg-12">
<p>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default btn-xs ">
<input type="radio" name="status" value="1" > Riêng tư
</label>
<label class="btn btn-default btn-xs active">
<input type="radio" name="status" value="2" checked> Bạn bè
</label>
<label class="btn btn-default btn-xs">
<input type="radio" name="status" value="3"> Mọi người
</label>
</div>
</p>
<p><div class="input-group">
<textarea name="content" class="form-control" required="required" id="contentArea" placeholder="Bạn đang nghĩ gì?"></textarea>
<span class="input-group-addon" id="showsmile" data-toggle="collapse" data-target="#emoticons">
<span class="fa fa-smile-o"></span>
</span>
</div>
</p>
<p align="center"><button name="sendmessage" type="submit" value="submit" class="btn btn-success" style="width:45%;" >
<span class="glyphicon glyphicon-send" >
</span>
</button>
<div id="emoticons" class="collapse">

</div>
</div>
</div>
</form>
</div>
</li>


{#blog chat#}

{%for i in get_data("blog_"~uri[1])[0].data|split("@")%}
{%if loop.last==false%}
{%set btn=get_data("blog_comment_"~uri[1])[0].data|json_decode["list_blog_"~(i|trim)]%}
{%set btn1=get_data("user_"~btn["nick"])[0].data|json_decode%}{%set btn2=get_data("user_"~btn["share"])[0].data|json_decode%}
{%if sign|lower in get_data("friends_"~uri[1])[0].data|replace({" ":""})|split("@") or sign==btn["nick"] or btn["blog_act"]=="3"%}

<li class="timeline_item">{%if btn["img"]%} <i class="fa fa-camera bg-purple"></i>
{%elseif btn["share"]%}<i class="fa fa-envelope bg-aqua"></i>
{%else%}<i class="fa fa-user bg-blue"></i>{%endif%}
<div class="timeline-item">
<span class="time"><a style="color: #999;" href="/blog/detail-{{i|trim}}-0.html">
<i class="glyphicon glyphicon-link"></i></a> <i class="fa fa-clock-o"></i> <span class="timeago">
{{k.ago(btn["time"])}} </span>
<span class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="caret"></i></a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a onclick="return confirm('Bạn có chắc chắn muốn xóa blog này?')" href="/blog/delete/{{i|trim}}">Xóa</a></li>
<li id="report{{i|trim}}" style="">
<a href="#" class="report" id="{{i|trim}}"><span class="report_b"><i class="fa fa-ban"></i> Báo xấu </span></a>
</li>
<li style="display:none" id="areport{{i|trim}}" style=""><a href=""><i class="glyphicon glyphicon-ok"></i> Báo xấu thành công</a></li>

</ul>
</span>
</span>
<h3 class="timeline-header">

<img style="vertical-align:middle;" src="http://avatarmusik.vn/forum/app/images/img/{%if btn1.on<"now"|date("U")-300%}offline{%else%}online{%endif%}.png" border="0" />

<span class="box_oxx_{{btn1.level}}"><a href="/beta/user/{{btn1.nickk}}">{{btn1.nick}}</a> </span>
{%if btn["share"]%}<i class="fa fa-arrow-circle-o-right"></i> <img style="vertical-align:middle;" src="http://avatarmusik.vn/forum/app/images/img/{%if btn2.on<"now"|date("U")-300%}offline{%else%}online{%endif%}.png" border="0" />

<span class="box_oxx_{{btn2.level}}"><a href="/beta/user/{{btn2.nickk}}">{{btn2.nick}}</a> </span> {%endif%}
<small>cập nhật trạng thái <i class="fa fa-{{btn["blog_act"]|replace({"1":"user","2": "users","3":"globe"})}}"></i></small></h3>
<div class="timeline-body">
<p>{{btn["content"]}}</p>
<div class="likebutton">
<div>
<div id="follow{{i|trim}}" style="display:nones"><a href="#" class="follow" id="{{i|trim}}"><span class="follow_b"> <i class="fa fa-heart-o"></i> Thích </span></a></div>
<div id="remove{{i|trim}}" style="display:none"><span class="youfollowing_b"><i class="fa fa-heart"></i></span><a href="" id="{{i|trim}}" class="remove"><span class="remove_b"> Bỏ thích </span></a></div>
</div>
</div>
<span id="loading{{i|trim}}"></span>
</div>

</div>
<div class="panel-footer">
<div class="timeline-small" id="text_like{{i|trim}}">
{%if btn["list_like"]|split("@")|length-1>=1%} <span style="color:#333;"><span style="color:red">♥</span> {%for c in btn["list_like"]|replace({" ":""})|split("@")|reverse%}{%if loop.first==false%}{{k.get("user_"~c|trim," nick")|replace({(sign):"Bạn"})}}{%if loop.last==true%},{%endif%}{%endif%}{%endfor%} thích điều này</span>
{%endif%} </div>



{#comment blog #}

<form method="post" action="#">
{%if k.get("blog_list_chat")|split("@")|length-1>=1%}{%else%} <a data-toggle="collapse" data-target="#show-comment{{i|trim}}"><small>
<i class="fa fa-comment"></i> Bình luận đầu tiên</small></a>
{%endif%} <div class="{%if k.get("blog_list_chat")|split("@")|length-1>=1%}{%else%}collapse{%endif%}" id="show-comment{{i|trim}}">
<div class="input-group">
<textarea name="comment" id="comment_{{i|trim}}" class="form-control"></textarea>
<span id="{{i|trim}}" class="input-group-addon submitcomment">
<span class="glyphicon glyphicon-send "></span>

</span>
</div><!-- /input-group -->
</div>
</form>
<div id="flash" >
</div>
<ul class="list-group" id="update_{{i|trim}}">

{%for e in get_data("blog_list_chat")[0].data|split("@")%}
{%if loop.last==false%}
{%set e0=e|split("-")[0]|trim%}{%set e1=e|split("-")[1]|trim%}
{%set v_t=get_data("blog_chat")[0].data|json_decode["blog_"~e0~"_"~e1]%}

{%set n=get_data("user_"~v_t["nick"])[0].data|json_decode%}
{%if i|trim==v_t["id_blog"] %}
<li class="list-group-item" id="comment_{{e0}}" >
<span class="pull-right">
<a href="/beta/user/{{n.nickk}}">
<img class="thumbnail" height="30px" src="{{n.icon}}"/>
</a></span>
<h6 class="list-group-item-heading box_oxx_{{n.level}}">

<img style="vertical-align:middle;" src="http://avatarmusik.vn/forum/app/images/img/online.png" border="0" />

<a href="/beta/user/{{n.nickk}}"> {{n.nick}}</a>
<small><i><span class="timeago">
{{k.ago(v_t.time)}} </span>
<a onclick="return confirm('Bạn có chắc chắn muốn xóa bài blog này?');" href="/blog/delete-cm?id={{e0}}&postid={{e1}}"><span class="glyphicon glyphicon-remove"></span></a>
</i>

</small>
</h6>
<p class="list-group-item-text">{{v_t.msg|escape}}</p>
</li>

{%endif%}
{%endif%}
{%endfor%}
</ul>
</div>
</li>
{%endif%}{%endif%}

{%endfor%}
</ul> <div style="display:none"><ul class="pagination">
</ul></div>

</div>

</div>

</div>
<p></p>
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
<div class="slides"></div>
<h3 class="title"></h3>
<a class="prev">‹</a>
<a class="next">›</a>
<a class="close">×</a>
<a class="play-pause"></a>
<ol class="indicator"></ol>
</div>
</div>

{%endif%}
{{block("foot")}}
{%endif%}
{%endif%}
{%endif%}
* SpiderSilk  (Member) [Off]
41 * 185
*   Cách đây 2 tháng
Gửi từ Ivoryss:
Chào anh em nay mình xin mạnh dạn nhấn mạnh share chức năng Blog [red]Chức năng [/red] Đăng blog (riêng tư ,bạn bè, mọi người) - thích blog , xóa blog của mình - đăng blog trên cá nhân n ...
Chiểu giỏi dữ ta
[Like=26] bIackangel , Ivoryss , Zink , MrDucz2k , Dai , Anhviptn , Yong , knhoten , A05 , tiaxgame , copecute , Poker , PYB , ads , phong , Min , Nhim , Sksksk , zPMTpro , thanmatienthanh , Tuankill , Otamegane , Anhsa0 , kudat , Vinahose , visaotinhyeu11
* Ivoryss  (Member) [Off]
30 * 33
*   Cách đây 2 tháng
Ae dùng code group đi
* Ivoryss  (Member) [Off]
30 * 33
*   Cách đây 2 tháng
Ae dùng ssee
▼ Tổng số: 4
- Share:
BBCode:

Link: