如何获取和设置Delta值?

发布于 2024-09-11 17:34:23 字数 247 浏览 0 评论 0原文

如何影响 delta 参数值?哪里可以设置?

我是 Drupal 的初学者,但了解 PHP 和其他 CMS 应用程序(例如 Joomla)。我正在开发我的第一个 drupal 模块,需要创建一个具有多个块的模块。我知道如何根据 $op 参数进行切换,但 $delta 值似乎始终是函数声明中设置的默认值。

如何选择要处理和显示的块?是否可以设置 $delta 以便在使用模块时子导航使用 delta 切换到另一个块视图?

提前致谢。

How can I affect the delta parameter value? Where it can be set?

I'm beginner with Drupal but know my way around PHP and other CMS apps e.g. Joomla. I've working on my first drupal module and need to create a module with multiple blocks. I know how to switch based on the $op parameter but the $delta value seems always to be the default value set in the function declaration.

How can I select which block to process and display? Can $delta be set so that when using modules subnavigation is uses delta to switch to another block view?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

屌丝范 2024-09-18 17:34:23

hook_block() 用于定义块并显示块。您在为 $op='list' 生成数据时定义增量,当为 $op='view' 调用它时,该增量将传递回挂钩。

因此 $delta 参数将是您定义的任何内容。如果您将列表数组中的键定义为红色、绿色和蓝色,则显示块时将传递这些键。

也许查看示例会对您有所帮助。

hook_block() is used for defining a and displaying blocks. You define the delta when you are producing the data for $op='list' this is passed back to the hook when it it is called for $op='view'.

the $delta argument will therefore be whatever you define. If you define the keys in your list array as red, green and blue that is what will be passed if the block is displayed.

Maby looking at the example will help you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文