반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

Kurogo Tutorial 22 - Content Module -

2012. 10. 10. 01:44 | Posted by 솔웅


반응형

Content Module


content module은 다른 소스로부터 자유롭게 content를 모으고 display 할 목적으로 만들어 졌습니다. Content Module은 다른 HTML site 나 RSS feed 로부터 display 된 곳으로부터 content를 모아서 display 할 수 있습니다. 또한 configuration file이나 administration module을 사용해서 static content configured 를 display 하도록 할 수 있습니다.

디폴트로 content 모듈은 리스트에 그 feed 를 display 합니다. 그리고 나서 유저가 feed를 선택하면 그 feed 의 content가 보여지게 되는 겁니다. 만약에 feed 가 1개만 있다면 리스트 대신 그 feed 가 보여집니다. 옵션으로 group화 할 수 있습니다.


Configuring Content Feeds


SITE_DIR/config/MODULE/feeds.ini file에 원하는 만큼의 feed 를 정의 하세요. 각 feed 는 section에 의해 표현됩니다. 그 섹션의 이름은 모듈의 page를 의미합니다. 이곳에는 configure 할 몇가지 property들이 있습니다.


  • TITLE - The title of the feed. This is shown in the list and in the navigation bar
  • CONTENT_TYPE - the type of content. Values include:
    • html - Static html text that is included in the CONTENT_HTML property
    • html_url - Fetch HTML content from the BASE_URL property.
    • rss - Fetch RSS content from the BASE_URL property. Will retrieve the content from the first item in the feed. Good for CMS’s that expose their content via RSS. Ensure that this feed contains the full content and not just a link



Creating Groups of Content


  • NOTE - Creation of content groups is not supported in the admin console at this time.

You can create groups of content in order to organize similar content into categories. Creating content groups involves the following steps:

유사한 콘텐트를 하나의 카테고리에 묶기 위해 콘텐트의 group을 만들 수 있습니다. 아래와 같이 group을 생성하시면 됩니다.

  1. SITE_DIR/config/MODULE/feedgroups.ini 파일을 생성한다.
  2. 그룹 이름을 feedgroups.ini 의 section 안에 넣는다. 스페이스나 특수문자가 없는 alpha numeric 소문자이어야 한다.
  3. 섹션에는 TITLE option이 있어야 한다. 이것은 그룹의 title을 나타낸다. 옵션으로 DESCRIPTION value를 넣을 수 있다. 이것은 그룹의 리스트 top에 보여질 내용이다.
  4.  SITE_DIR/config/MODULE/feeds-groupname.ini  파일을 만든다. groupname is the short name of the group you created in feedgroups.ini. This file should be formatted like feeds.ini with each entry being a uniquely indexed section.
  5. 이 그룹을 사용하기 위해 eeds.ini. 안에 entry를 할당한다. 그룹의 short name 값으로 GROUP 값을 넣는다. 옵션으로 TITLE을 넣을 수 있다. 이것은 eedgroups.ini 안에서 group title 대신에 쓰이게 된다.

feeds.ini file에는 groups와 content entry 들이 있을 겁니다. 이것들은 section의 순서대로 display 될 겁니다. 만약 1개의 그룹만이 있다면 그 그룹이 display 될 겁니다.

아래는 SITE_DIR/config/MODULE/feedgroups.ini 예제입니다. 각 그룹은 TITLE이 있는 section 입니다. 여러분이 원하는 만큼의 그룹을 만들 수 있습니다.


[applying]
TITLE = "Applying to Universitas"
DESCRIPTION = ""

[visiting]
TITLE = "Visiting"
DESCRIPTION = ""


SITE_DIR/config/MODULE/feeds-applying.ini.  아래는 applying group 예제입니다. feeds.ini file처럼 format 됐습니다.


[admissions]
TITLE = "Admissions"
SUBTITLE = ""
SHOW_TITLE = 0
CONTENT_TYPE = "html_url"
BASE_URL = "http://universitas.modolabs.com/admissions"
HTML_ID = "node-2"


SITE_DIR/config/MODULE/feeds.ini


[applying]
TITLE = "Applying to Universitas"
GROUP = "applying"

[visiting]
TITLE = "Visiting"
GROUP = "visiting"

[othercontent]
TITLE = "Other Content"
SUBTITLE = ""
SHOW_TITLE = 0
CONTENT_TYPE = "html_url"
BASE_URL = "http://www.example.com/othercontent"
HTML_ID = "html-id"


Options for HTML Content


HTML document에서 data를 추출하기 위해서는 몇가지 옵션이 추가로 있습니다. 대부분의 경우 HTML, HEAD 태그 같은 것들은 건너뛰고 header와 footer 들도 remove 할 겁니다. 그리고 그 HTML 문서의 일부분만 사용하길 원하겠죠. 어떤 content 를 포함 시킬것인지 결정하는 방법에는 두가지가 있습니다.

  • HTML_ID - Use this option to include only a single element (and its child elements) based on its HTML id attribute. This is the simplest, and most recommended option if it is available. The value for this option is case sensitive.
  • HTML_TAG - Use this to include all elements of a certain tag. For instance set it to “table” to include all table elements or “p” to include all paragraph elements. Do not include the surrounding brackets (<, >)


만약 이 옵션을 사용하지 않으면 body tag 전체가 추출될 겁니다.


반응형