"轻松精简view模块代码"
Published on Aug. 22, 2023, 12:09 p.m.
使用view是够爽的,我们可以轻而易举的定制自己的页面。不过对于由view生成的大量的垃圾代码也是令我们头疼,今天在http://viiiix.com/网站上找到了一个不错的解决方案,相比与腹泻模板确实是能够让人愉悦一番。
Semantic Views模块就是一个,不多说看看官方给出的例子
Before
<div>
<div>
<span><a href=”/node/1〃>Augue Magna Cui Conventio Valetudo</a></span>
</div>
<div>
<span>Story</span>
</div>
<div>
<div>
<p>
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.
</p>
</div>
</div>
<div>
<label>Delete link:</label> <span><a href=”/node/1/delete&destination=semantic-views-demo”>delete</a></span>
</div>
<div>
<label>Edit link:</label> <span><a href=”/node/1/edit&destination=semantic-views-demo”>edit</a></span>
</div>
</div>
After
<div>
<h2><a href=”/node/1〃>Augue Magna Cui Conventio Valetudo</a></h2>
<div>
Story
</div>
<p>
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.
</p>
<div>
<label>Delete link:</label> <a href=”/node/1/delete&destination=semantic-views-demo%2Funformatted-semantic”>delete</a>
</div>
<div>
<label>Edit link:</label> <a href=”/node/1/edit&destination=semantic-views-demo%2Funformatted-semantic”>edit</a>
</div>
</div>
不错吧,感兴趣的朋友可以下载http://ftp.drupal.org/files/projects/semanticviews-6.x-1.1.tar.gz