게시판 요약 줄바꿈, xe에서는 되는데 라이믹스에서는 안되는 이유가 뭘까요?
CMS/프레임워크 | Rhymix 2.0 |
---|---|
개발 언어 | PHP 7.0 |
라이믹스에서는 안되고
https://xetown.com/questions/852573
xe에서는 되고
http://xe.sketchbook.kr/faq/52494
{nl2br($document->getSummary($mi->content_cut_size))}
같은 함수인데 이유가 뭔지 아시는분은 계신가요?
라이믹스용 해결책을 좀 알려주시면 감사하겠습니다.
getContent 로 가져오면 nl2br 이 먹히고 (두칸 띄워짐) ... 첩첩산중 입니다.
그냥 만들어놓은 스킨이나
안되는 안되는데로 컨텐츠 채우면 되는데,
답변 달아주시는 고수분들처럼 라이믹스를 가지고 놀고 싶어요.
궁금합니다.
댓글 3
라이믹스는 getSummary에서 내용을 한 줄로 요약하여 제공합니다.
줄바꿈이나 그 밖의 공백 문자는 모두 제거됩니다.
이 함수를 주로 메인화면 위젯 같은 곳에서 사용하는데,
불필요하게 줄바꿈을 많이 넣어 놓는 유저들 때문에
이렇게 나오는 게 싫다고 하는 분이 줄바꿈을 그대로 보여주기를 원하는 분보다 압도적으로 많고,
CKEditor 특성상 nl2br을 적용하면 정상적인 게시물도 두 줄씩 띄워서 나오는 경우가 많기 때문입니다.
줄바꿈은 그대로 유지하되 두 줄씩 띄어지는 것은 싫다고 하신다면
getContent로 가져와서 태그를 모두 없애고 두 줄 이상 떨어진 경우를 인식하여 한 줄로 바꿔주는 등,
좀더 지능적으로 처리하는 함수를 따로 만드셔야 할 것으로 보입니다.
이걸 라이믹스에 붙여넣기 하면 줄바꿈 될 수있을까요?
xe1 1.9.6 ===================================================================
function getSummary($str_size = 50, $tail = '...')
{
$content = $this->getContent(FALSE, FALSE);
$content = nl2br($content);
// For a newlink, inert a whitespace
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
// Replace tags such as </p> , </div> , </li> and others to a whitespace
$content = str_replace(array('</p>', '</div>', '</li>', '-->'), ' ', $content);
// Remove Tags
$content = preg_replace('!<([^>]*?)>!is', '', $content);
// Replace < , >, "
$content = str_replace(array('<', '>', '"', ' '), array('<', '>', '"', ' '), $content);
// Delete a series of whitespaces
$content = preg_replace('/ ( +)/is', ' ', $content);
// Truncate string
$content = trim(cut_str($content, $str_size, $tail));
// Replace back < , <, "
$content = str_replace(array('<', '>', '"'),array('<', '>', '"'), $content);
return $content;
}
===================================================================
라이믹스 ============================================================
function getSummary($str_size = 50, $tail = '...')
{
// Remove tags
$content = $this->getContent(false, false);
$content = strip_tags(preg_replace('!<(style|script)\b.+?</\\1>!is', '', $content));
// Convert temporarily html entity for truncate
$content = html_entity_decode($content, ENT_QUOTES);
// Replace all whitespaces to single space
$content = utf8_trim(utf8_normalize_spaces($content));
// Truncate string
$content = cut_str($content, $str_size, $tail);
return escape($content);
}
사실 해봤는데 안되더라고요... ㅜ..ㅜ
혹시나 줄바꿈 검색해서 오는 회원님들 참고하시라고 올려놓습니다.
가진곰님 안녕하세요.
생각해보니까 줄바꿈 없는것을 유저들이 원하고... 장점이 될것 같습니다.
궁금한부분을 해결해주셔서 감사드립니다. ^^=b
언제가 될지 기약은 없겠지만 ..
혹시 제가 함수 만들게되면 공유해볼께요.