Drupal 是否有打印按钮(如打印链接)
Drupal 有一个打印链接功能,我在 .tpl.php
<?php
print l(t('Announcement'), 'node/30');
?>
l
中使用它,使其成为一个链接。 drupal 是否有等效的 API 函数来制作按钮?
如果没有,您对此最好的建议是什么?
Drupal has a print link function that I'm using in my .tpl.php
<?php
print l(t('Announcement'), 'node/30');
?>
l
makes it become a link. Does drupal have an equivalent API function to make buttons?
If not, what's your best suggestion for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于你所说的“按钮”的含义。
如果您谈论的是实际的表单按钮,那么您将需要查看 drupal 表单 API 以了解如何制作表单。
如果你正在谈论制作看起来像按钮的东西,那么我仍然会使用 l(),但传递类似“class”=>; 的东西。将“my-fancy-button”添加到属性数组中,然后使用 CSS 设置 my-fancy-button 类的样式 - 可以简单地使用背景颜色和一些边框,也可以使用更复杂的图像背景。
It comes down to what you mean by 'button'.
If you are talking about an actual form button, then you will want to look at the drupal form API for how to go about making forms.
If you are talking about making something that looks like a button, then I would still be using l(), but pass along something like "class" => "my-fancy-button" to the attributes array, then style the my-fancy-button class with CSS - either simply with a bg colour and some borders, or with a more complicated image background.
从这里开始:http://api.drupal.org
关于表单: http://api.drupal.org/api/group/form_api/6
关于编写模块:http://drupal.org/developing/modules
此处的表单和其他示例:http://drupal.org/project/examples
Start here: http://api.drupal.org
About forms: http://api.drupal.org/api/group/form_api/6
About writing modules: http://drupal.org/developing/modules
Examples of forms and others here: http://drupal.org/project/examples