主题视图块命名约定
我只是尝试设计名为 sidegalery 的视图块的样式。
我在正在运行的主题文件夹中放置了一个名为 block-views-sidegalery-block_1.tpl.php 的文件。
但现在我阅读了视图文档,发现视图 UI 中存在“主题:信息”链接。建议使用文件名views-view--sidegalery--block.tpl.php。
这比我的第一次尝试更正确吗?有什么区别?如果两者都正确,哪个主题文件最终会覆盖谁?
问候马库斯
I just try to style the block of a view called sidegalery.
I placed a file called block-views-sidegalery-block_1.tpl.php in my themes folder which is working.
But now I read in the views documentation and found that "Theme: Information" link in the views UI. There the filename views-view--sidegalery--block.tpl.php is suggested.
Is this more correct than my first attemp? What is the difference? And if both is correct which theme file will overwrite whom in the end?
Regards marcus
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“主题:信息”下列出的信息建议从通用到非常具体的主题模板。通过使用模板“views-view--sidegalery--block.tpl.php”,您将以相同的方式为“sidegalery”视图中的所有块设置主题。通过使用“block-views-sidegalery-block_1.tpl.php”模板,它将仅适用于该特定块,即 block_1,即您在视图中创建的第一个块。仅当您创建多个显示器并希望以不同的方式(或全部相同)主题时,命名约定才重要。
The information listed under the "Theme:Information" suggests templates from generic to very specific for theming. By using the template "views-view--sidegalery--block.tpl.php", you will be theming all blocks in your "sidegalery" view the same way. By using the "block-views-sidegalery-block_1.tpl.php" template, it will only apply to that specific block, being block_1, the first block you have created in the view. The naming conventions only matter if you are creating multiple displays and want to theme them differently (or all the same).