위젯 만들기
위젯을 구현하기 위해 필요한 요청 데이터 식별자와 응답 결과 구조를 안내합니다.
콘솔에서 생성된 위젯은 데이터식별자에 widget 속성(property)으로 추가합니다.
데이타 식별자
{
"dataID": "Some dataID",
"property key": "Some Data Identifier property value",
"widget":["widget_code_1","widget_code_2"]
}
Key | Description |
---|---|
widget | 콘솔에서 생성된 웨젯코드를 요소로 하는 배열 |
Response Result
{
"content_category": "200",
"content_limit": "5",
"content_sort": "asc",
"create_date": "2025-01-01 12:00:13",
"description": "인기 게시물",
"widget_code": "top_post",
"widget_key": "b9897jdfuidyuh23",
"widget_type": "bbs_daily_rate",
"content_list": [
{"subject": "Subject 1","seq": 101,"create_date":"2025-01-01 12:00:13"},
{"subject": "Subject 2","seq": 209,"create_date":"2025-01-04 12:00:13"}
]
}
Key | Description |
---|---|
content_category | 위젯 콘텐츠 카테고리(게시판 시퀀스 등) |
content_limit | 콘텐츠 노출 수 |
content_sort | 콘텐츠 정렬(asc or desc) |
create_date | 위젯 생성일 |
description | 웨젯 설명 |
widget_code | 위젯 코드 |
widget_key | 위젯 키 |
widget_type | 위젯 형식(bbs_daily_rate:조회율 순,bbs_create_date:등록일 순,custom:사용자 지정 게시물) |
content_list | 위젯 콘텐츠 - 게시물 목록과 동일한 Response |
Example
위젯 1
- 게시물 내용입니다.7.40 View/Day
- 게시물 내용입니다.6.40 View/Day
- 게시물 내용입니다.5.40 View/Day
- 게시물 내용입니다.4.40 View/Day
- 게시물 내용입니다.3.40 View/Day
위젯 n
- 게시물 내용입니다.23.11.07
- 게시물 내용입니다.23.11.06
- 게시물 내용입니다.23.11.05
- 게시물 내용입니다.23.11.04
- 게시물 내용입니다.23.11.03
<div class="bg-white p-3 rounded-3">
<div>
<h6 class="mb-3">많이본 게시물</h6>
<ul class="list-group list-group-flush">
<li class="list-group-item bg-transparent px-1" v-for="post in output.widget.most_read_post.content_list">
<div class="d-flex justify-content-between align-items-center">
<a :href="'/community/detail?post_key='+post.post_key" class="text-black">
<small class="crop-text-1">{{ post.subject }}</small>
</a>
<small>{{ post.create_date }}</small>
</div>
</li>
</ul>
</div>
</div>
<div class="bg-white p-3 rounded-3">
<div>
<h6 class="mb-3">많이본 게시물</h6>
<ul class="list-group list-group-flush">
<? foreach($output['widget']['most_read_post']['content_list'] as $intKey=>$arrPost){ ?>
<li class="list-group-item bg-transparent px-1">
<div class="d-flex justify-content-between align-items-center">
<a href="/community/detail?post_key=<?=$arrPost['post_key'];?>" class="text-black">
<small class="crop-text-1"><?=$arrPost['subject'];?></small>
</a>
<small><?=$arrPost['create_date'];?></small>
</div>
</li>
<? } ?>
</ul>
</div>
</div>