리스트 글씨제한에 관련하여
본문
https://sir.kr/g5_skin/21139?sfl=wr_subject%7C%7Cwr_content&stx=ajax&page=3 님의 스킨을 적용하였습니다.
<a href="javascript:;" onclick="collapse('<?echo $list[$i]['href']?>','<?echo $list[$i]['wr_id']?>', false)">
<?php echo apms_cut_text($list[$i]['wr_content'], 160,'… <span class="font-11 text-muted">더보기</span>');?>
</a>
<?php echo $write_pages; ?>
<script>
var coll = true;
var other = null;
function collapse(href,id,comment)
{
$.ajax({
url: href,
type: 'post',
data: $(this).serialize(),
success: function (data)
{
var content = /<!-- 게시물 읽기 시작 { -->([\s\S]+?)<!-- } 게시판 읽기 끝 -->/.exec(data);
if($("#"+other).css("display") != "none")
{
$("#"+other).empty();
$("#"+other).hide();
}
other = id;
if(!comment)
{
$("#"+id).html(content[1]);
}
else
{
$("#"+id).html(content[1]);
}
},
complete : function ()
{
if(!comment){
$(".view_content"+id).show();
if($("#"+id).css("display") == "none")
{
$("#"+id).show();
coll = true;
}else{
if(!coll)
{
$("#"+id).show();
if(other!=id)
$("#"+id).hide();
coll = true;
}
else
{
$("#"+id).hide();
}
}
}else
{
$(".view_content"+id).hide();
if($("#"+id).css("display") == "none")
{
$("#"+id).show();
coll=false;
}else{
if(coll)
{
$("#"+id).show();
coll=false;
}
else
{
$("#"+id).hide();
}
}
}
}
});
}
</script>
1. 더보기에만 <a href="javascript:;" onclick="collapse('<?echo $list[$i]['h~~~)를 입힐 수 없을까요?
2. 더보기 클릭시 리스트의 글과 뷰의 글을 잇고 싶은데 160자 이후의 글만 이어져서 출력되게 할 수 있을까요?
고수님들의 도움 부탁드립니다 ㅜㅜㅜ
!-->답변 2
열공하시네요~~
1. 아래와 같이 수정하시면 되구요..
<?php echo apms_cut_text($list[$i]['wr_content'], 160,'…');?> <a href="javascript:;" onclick="collapse('<?echo $list[$i]['href']?>','<?echo $list[$i]['wr_id']?>', false)"><span class="font-11 text-muted">더보기</span></a>
2. 질문이 이해가 안되네요..
왜 굳이 160자 이후의 내용만 나오게 하실려는건지?
방법은 전체 내용에서 160자의 내용을 삭제하는 방법은 있습니다.
예) str_replace(apms_cut_text($list[$i]['wr_content'], 160,' '),"",$list[$i]['wr_content']);
!-->
답변을 작성하시기 전에 로그인 해주세요.