컨텐츠 종류에 따라 노드 정보(글의 작성자, 등록일시)의 출력형태를 커스터마이징해 보자.

팔팔.오알지는 오래된 글들이 많다.
제일 오래된 것들은 2007년 9월의 글이다.

그럼에도 불구하고 이들 글들은 대부분은 아직도 유효하다.
대부분의 글들이 드루팔 메이저 버전5와 6에서 작성됐으며
버전 6의 경우에는 아직도 현역이기 때문이다.
(드루지기들은 대부분의 실무 프로젝트를 이 버전으로 합니다)

최근에는 버전 7이 주력으로 돼 가고 있으나, 버전 6에서의
모듈들이나 기능들은 7에서도 거의 비슷한 형태이다.
(요약하자면 드루팔 6을 잘 다룰 줄 알면 7도 그렇게 어렵지 않다는 말입니다)

그래서인지 예전 글들임에도 불구하고 종종 다시 보게 되고,
틈틈히 글 내용을 수정하면서, 옛 글도 새 글 못지 않게 생명력을 가지게 되었다.

하지만, 보통의 드루팔 테마들은, 노드 정보(글 정보. submitted by....와 날짜 부분)가 안습이다.

아래 옛 테마의 노드 정보 형태를 보라. 한영 섞인 것도 아쉬운데다가 날짜는 왜 최초 작성일 뿐인가. 다시 수정한 글은 새 글 못지 않은데, 수정한 날짜가 보이질 않는다.

작성자 이름 Posted at 12:48 on 토, 05/25/2008

혹은

Submitted by palpal on 일, 2008-05-25 12:48

차라리 보이지 않았으면 해서, 관련글 [컨텐츠 종류에 따라 글의 작성자, 등록일시를 화면에서 보이지 않고 싶은 경우] 같은 시도도 있었다.

하지만 뒤늦게 아래와 같이 노드 정보를 커스트마이징 가능한 모듈을 찾았다.

2012-09-27 updated, 2008-05-25 created by palpal

새로 작성한 글이라면 다음과 같이,
2012-09-27 updated, 2012-09-27 created by palpal

이러한 기능의 모듈은, submitted_by 이다.
http://drupal.org/project/submitted_by

이 모듈을 설치/활성화하고 나면,
각각의 컨텐츠 타입 설정 메뉴에,
"Submitted by" Appearance
항목이 보인다.

이 항목에 다음과 같은 대치 패턴 문자열을 넣으면,

[last-edit-yyyy]-[last-edit-mm]-[last-edit-dd] updated,  [yyyy]-[mm]-[dd] created by [author-name]

위에서 보여준 개선된 노드 정보 형태가 나타난다!
이로써 새로이 수정한 옛 글도, 생성일 뿐만 아니라 수정일까지 표시할 수 있게 되었다.

대치 패턴 문자열(Replacement tokens 항목)은,
아주 다양한 예가 있는데, 유명하고 아주 유용한 Tokens모듈의 힘을 빌려 다음과 같은 대치 문자열이 가능하다.

Token Replacement value
Book tokens
[book] The title of the node's book parent.
[book-raw] The title of the node's book parent. Warning: Token value contains raw user input.
[book_id] The id of the node's book parent.
[bookpath] The titles of all parents in the node's book hierarchy.
[bookpath-raw] The titles of all parents in the node's book hierarchy. Warning: Token value contains raw user input.
Node tokens
[author-link] Link to author.
[author-mail] The email address of the author of the node.
[author-mail-raw] The email address of the author of the node. Warning: Token value contains raw user input.
[author-name] The login name of the author of the node.
[author-name-raw] The login name of the author of the node. Warning: Token value contains raw user input.
[author-uid] The unique ID of the author of the node.
[created-since] Node created date - interval.
[created-updated] Node created and updated dates (system small date)
[d] Node creation day (one or two digits without leading zeros)
[date] Node creation date (numeric representation of the day of the week)
[day] Node creation day (full word)
[dd] Node creation day (two digits with leading zeros)
[ddd] Node creation day (abbreviation)
[language] The language the node is written in.
[last-edit-d] Node last edit day (one or two digit)
[last-edit-date] Node last edit date (day of week)
[last-edit-day] Node last edit day (full word)
[last-edit-dd] Node last edit day (two digit, zero-padded)
[last-edit-ddd] Node last edit day (abbreviation)
[last-edit-hh] Node last edit hour in 12-hour format(two digit, zero-padded)
[last-edit-ii] Node last edit minute (two digit, zero-padded)
[last-edit-large] Node last edit - large
[last-edit-m] Node last edit month (one or two digit)
[last-edit-medium] Node last edit - medium
[last-edit-mm] Node last edit month (two digit, zero padded)
[last-edit-mon] Node last edit month (abbreviated)
[last-edit-month] Node last edit month (full word)
[last-edit-since] Node last edit - interval
[last-edit-small] Node last edit - small
[last-edit-ss] Node last edit second (two digit, zero-padded)
[last-edit-type] The last edit type (created, changed) for the node.
[last-edit-ww] Node last edit week (two digit)
[last-edit-yy] Node last edit year (two digit)
[last-edit-yyyy] Node last edit year (four digit)
[last-editor] The last user to edit the node.
[log] The explanation of the most recent changes made to the node.
[log-raw] The explanation of the most recent changes made to the node. Warning: Token value contains raw user input.
[m] Node creation month (one or two digits without leading zeros)
[menu] The name of the menu the node belongs to.
[menu-link-mlid] The unique ID of the node's menu link.
[menu-link-parent-path] The URL alias of the parent menu link of the node.
[menu-link-parent-path-raw] The URL alias of the parent menu link of the node. Warning: Token value contains raw user input.
[menu-link-plid] The unique ID of the node's menu link parent.
[menu-link-title] The text used in the menu as link text for this item.
[menu-link-title-raw] The unfiltered text used in the menu as link text for this item. Warning: Token value contains raw user input.
[menu-raw] The name of the menu the node belongs to. Warning: Token value contains raw user input.
[menupath] The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /.
[menupath-raw] The unfiltered menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /. Warning: Token value contains raw user input.
[mm] Node creation month (two digits with leading zeros)
[mod-d] Node modification day (one or two digits without leading zeros)
[mod-date] Node modification date (numeric representation of the day of the week)
[mod-day] Node modification day (full word)
[mod-dd] Node modification day (two digits with leading zeros)
[mod-ddd] Node modification day (abbreviation)
[mod-m] Node modification month (one or two digits without leading zeros)
[mod-mm] Node modification month (two digits with leading zeros)
[mod-mon] Node modification month (abbreviated)
[mod-month] Node modification month (full word)
[mod-raw] Node modification in UNIX timestamp format (1348753783)
[mod-since] Node modification in 'time-since' format. (42 년 40 주)
[mod-small] Node modification date in 'small' format. (2012/09/27 - 22:49)
[mod-ww] Node modification week (two digits with leading zeros)
[mod-yy] Node modification year (two digit)
[mod-yyyy] Node modification year (four digit)
[mon] Node creation month (abbreviated)
[month] Node creation month (full word)
[nid] The unique ID of the content item, or "node".
[node-path] The URL alias of the node.
[node-path-raw] The URL alias of the node. Warning: Token value contains raw user input.
[node-url] The URL of the node.
[node_comment_count] The number of comments posted on a node.
[raw] Node creation in UNIX timestamp format (1348753783)
[since] Node creation in 'time-since' format. (42 년 40 주)
[small] Node creation date in 'small' format. (2012/09/27 - 22:49)
[term] Name of top taxonomy term
[term-id] ID of top taxonomy term
[term-raw] Unfiltered name of top taxonomy term. Warning: Token value contains raw user input.
[title] The title of the node.
[title-raw] The title of the node. Warning: Token value contains raw user input.
[type] The type of the node.
[type-name] The human-readable name of the node type.
[unread_comment_count] The number of comments posted on a node since the reader last viewed it.
[vocab] Name of top term's vocabulary
[vocab-id] ID of top term's vocabulary
[vocab-raw] Unfiltered name of top term's vocabulary. Warning: Token value contains raw user input.
[ww] Node creation week (two digits with leading zeros)
[yy] Node creation year (two digit)
[yyyy] Node creation year (four digit)
CCK text tokens
[field_bad-formatted] Formatted and filtered text
[field_bad-raw] Raw, unfiltered text Warning: Token value contains raw user input.
[field_field_theme_name-formatted] Formatted and filtered text
[field_field_theme_name-raw] Raw, unfiltered text Warning: Token value contains raw user input.
[field_good-formatted] Formatted and filtered text
[field_good-raw] Raw, unfiltered text Warning: Token value contains raw user input.
CCK file tokens
[field_screenshot-filefield-description] File description
[field_screenshot-filefield-extension] File extension
[field_screenshot-filefield-fid] File ID
[field_screenshot-filefield-filemime] File MIME type
[field_screenshot-filefield-filename] File name
[field_screenshot-filefield-filepath] File path
[field_screenshot-filefield-filesize] File size (in bytes)
[field_screenshot-filefield-filesize_formatted] File size (pretty printed)
[field_screenshot-filefield-fileurl] File URL
[field_screenshot-filefield-onlyname] File name without extension
[field_screenshot-filefield-view] Fully formatted HTML file tag
[field_tip_images-filefield-description] File description
[field_tip_images-filefield-extension] File extension
[field_tip_images-filefield-fid] File ID
[field_tip_images-filefield-filemime] File MIME type
[field_tip_images-filefield-filename] File name
[field_tip_images-filefield-filepath] File path
[field_tip_images-filefield-filesize] File size (in bytes)
[field_tip_images-filefield-filesize_formatted] File size (pretty printed)
[field_tip_images-filefield-fileurl] File URL
[field_tip_images-filefield-onlyname] File name without extension
[field_tip_images-filefield-view] Fully formatted HTML file tag
CCK number tokens
[field_columns-formatted] Formatted number value
[field_columns-raw] Raw number value Warning: Token value contains raw user input.
[field_quality-formatted] Formatted number value
[field_quality-raw] Raw number value Warning: Token value contains raw user input.
CCK node reference tokens
[field_related_node-link] Formatted html link to the referenced node.
[field_related_node-nid] Referenced node ID
[field_related_node-path] Relative path alias to the referenced node.
[field_related_node-title] Referenced node title
[field_related_node-title-raw] Referenced node unfiltered title. WARNING - raw user input.
[field_related_node-url] Absolute path alias to the referenced node.
CCK link tokens
[field_link-title] Link title
[field_link-url] Link URL
[field_link-view] Formatted html link

* 참고 : 본 글의 상단 태그 부분에 있는, submitted by 링크는 "노드 정보"가 아니라, 태그를 표시하는 텀즈(카테고리 개념의 텍사노미 관련)입니다. 혹 고장난 것처럼 보일까 오해 마시라고 기록합니다. 팔팔.오알지의 팁 글들에는 관련 모듈의 명칭이 영문 그대로 텀즈에 박혀 있는 경우가 많습니다.

Comments

다소 용도가 어긋나긴 하지만, 본 모듈을

다소 용도가 어긋나긴 하지만, 본 모듈을 활용하면
breadcrumb (일본어로 パンくず) 를 입맛대로 구현할 수도 있겠다.

참고 : Taxonomy Breadcrumb 모듈 : http://drupal.org/project/taxonomy_breadcrumb
참고 : http://ja.wikipedia.org/wiki/パンくずリスト

2012년 9월 기준으로, 아래 테마들에서는 이

2012년 9월 기준으로, 아래 테마들에서는 이 모듈이 작동하지 않을 수 있다고 한다.

Artist C01
Nitobe
Acquia Marina
Zen
Orange

또한 테스트해 본 결과, 테마와 상관없이
"포럼" 컨텐츠 타입에서도 노드 정보가 커스터마이징 되지 않았다.