Drupal 6에서 스레딩 주석 변경 마크 업
문제
여기에 불쾌한 질문이 있습니다.
Drupal은 댓글을 처리하여 사용자에게 4 가지 방법으로 표시 할 수있는 선택을 제공합니다. Flat list - collapsed
, Flat list - expanded
, Threaded list - collapsed
, 그리고 Threaded list - expanded
.
마지막으로 사용하는 것은 다음과 같은 마크 업을 제공합니다.
<div class="comment">
<!-- comment's content -->
</div>
<div class="indented">
<!-- next comment is an 'answer' to the previous comment! -->
<div class="comment">
<!-- comment's content -->
</div>
</div>
그러나 나는 '부모'의견의 동일한 DOM 요소 내에서 '어린이'의견을하고 싶습니다. 예를 들어, 다음과 같습니다.
<div class="comment">
<!-- comment's content -->
<div class="indented">
<!-- next comment is an 'answer' to the previous comment! -->
<div class="comment">
<!-- comment's content -->
</div>
</div>
</div>
스레드 주석을 이 블로그 (WordPress 사용).
다음과 같은 마크 업을 사용합니다.
<ul>
<li>
<div class="comment>
<!-- comment's content -->
</div>
<ul class="children">
<li>
<div class="comment>
<!-- comment's content -->
</div>
</li>
</ul>
</li>
</ul>
그래서, 무엇입니까 드 루 팔리 이를 수행하는 방법 (필요한 모든 변경 사항이 Template.php 또는 템플릿 파일에있는 경우 더 좋습니다)?
해결책
comment_render () 내부적으로 모든 일을하는 것 같습니다. 따라서 이것을 다시 작성해야합니다. 불행히도 당신이 사용하는 경우 node_show () 노드를 렌더링하려면 Comment_Render가 자동으로 실행되므로 (재정의 가능한 테마 기능이 아닌) 원하는 작업을 수행하기 위해 많은 작업을 수행해야합니다.
먼저 사용해야합니다 hook_nodeapi Drupal Core에게 의견이 없음을 확신시키기 위해 대화 모듈 이것을한다)
function talk_nodeapi(&$node, $op) {
switch ($op) {
case 'load':
if (talk_activated($node->type) && arg(0) == 'node' && !arg(2)) {
// Overwrite setting of comment module and set comments for this node to disabled.
// This prevents the comments of being displayed.
$output['comment_original_value'] = $node->comment;
$output['comment'] = 0;
return $output;
}
break;
}
}
그런 다음 자신만의 댓글 _render 구현 (중첩 포함)을 작성하고 노드가 렌더링 된 후 (아마도 템플릿 페이지 또는 전처리 함수)를 호출해야합니다.