使用 Drupal Views VS 模板
我最近开始兼职使用 Drupal,并且必须解决在 Views API 中遇到的限制。更重要的是,我发现自己编写代码更快、更强大。
- 无论如何,如果不创建自定义文件,就很难创建具有特定外观和感觉的自定义视图。
- 在 *.tpl.php 中从头开始创建页面给了我更多的选择和灵活性。我现在已经做了几个,而且速度几乎一样快。
对于开发人员(因为这是一个编程论坛)您认为什么更好:
视图还是自定义模板?
I have recently started working with Drupal on the side and have had to tackle the limitations I come up against in the Views API. More than not I find it faster and more powerful to code it myself.
- It is hard to create custom views that have a specific look and feel without create custom files anyway.
- Creating the pages from scratch in a *.tpl.php gives me more choice and flexibility. I have done a couple of them now and it is almost as fast.
For a developer (since this is a programming forum) what is better in your opinion:
Views or Custom templates?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我什至不确定您所说的自定义模板是什么意思(请说您没有将 SQL 硬编码到 .tpl.php 文件中),但无论您的意思是什么,答案都是尽可能使用视图。
原因:
至于您的“很难创建具有特定外观和感觉的自定义视图”这一点,我认为使用 template_preprocess_whatever() 函数和重写视图模板一段时间后您会改变主意。只要你愿意,你就有绝对的控制权。
I'm not even sure what you mean by custom templates (please say you're not hardcoding SQL into .tpl.php files), but no matter what you mean, the answer is to use Views wherever possible.
Reasons:
As for your "it is hard to create custom views that have a specific look and feel" point, I think you'll change your mind after a little time with template_preprocess_whatever() functions and overriding Views templates. You have absolute control if you want it.