您在這裡

semantics views

Atimmy's 的頭像
Atimmy 在 2010-12-23 (四) 15:05 發表

當初剛接觸Drupal時,在嘗試views被被所產生的一堆不必要的div, span, etc還有一堆css classes 弄的烏烟瘴氣的,
當時總希望如果views不要每次都把頁面變成大怪獸就好了。

後來發現一個很實用的模組: semanticviews 。
這個module可以讓你在views ui自己命名每一個顯示欄位的class,決定個別欄位是用什麼html elements,讓theme developer
能用自己熟悉的方式去theme views。 各重要的是不須要動到template檔案,可以把views所產生的怪獸碼變從大野狼變成小綿羊 :)

使用semantcviews 之前,你的codes可能是:

Story

node (story) - Abigo bene feugiat loquor neo lenis qui imputo. Suscipere molior obruo typicus jus euismod ille illum meus. Acsi populus pecus populus lobortis metuo voco. Aptent plaga incassum. Iriure cui cui commoveo eum hos dolor ex consectetuer. Typicus eros vulputate defui comis nobis humo. Ulciscor abigo occuro. Sagaciter tego dolore. Voco iusto jus. Abdo dolor verto gilvus mos iaceo vel loquor.

Delete link: delete
Edit link: edit

用了semantics views之後,你的code就會變成類似:

Augue Magna Cui Conventio Valetudo

Story

node (story) - Abigo bene feugiat loquor neo lenis qui imputo. Suscipere molior obruo typicus jus euismod ille illum meus. Acsi populus pecus populus lobortis metuo voco. Aptent plaga incassum. Iriure cui cui commoveo eum hos dolor ex consectetuer. Typicus eros vulputate defui comis nobis humo. Ulciscor abigo occuro. Sagaciter tego dolore. Voco iusto jus. Abdo dolor verto gilvus mos iaceo vel loquor.

Delete link: delete
Edit link: edit

還不知道這個module 的人可以下載回來試試看:
http://drupal.org/project/semanticviews

: )