预处理对比drupal模板中的流程函数
之间有什么区别
function mythemes_preprocess_html(&$variables) { ... }
和
function mythemes_process_html(&$variables) { ... }
drupal 7 template.php
?何时必须使用预处理函数以及何时必须使用处理函数。
谢谢。
What is the difference between
function mythemes_preprocess_html(&$variables) { ... }
and
function mythemes_process_html(&$variables) { ... }
in drupal 7 template.php.
when must use preprocess functions and when must use process functions.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尽管在不同的阶段被称为,但它们实际上是同一件事。首先调用预处理函数并进行更改。然后在稍后阶段调用处理函数,并允许进行更改以更改预处理阶段期间引入的任何修改。
请参阅 http://drupal.org/node/223430 了解更多信息。
They're effectively the same thing albeit called in different phases. Preprocess functions are called first and changes are made. Process functions are then called at a later phase and allow for changes to be made to alter any modifications introduced during the preprocess phase.
See http://drupal.org/node/223430 for more information.
更准确地说,来自 Drupal API 文档:
如果您点击上面的链接,它将按顺序列出,整个 theme() 进程,从处理函数到预处理函数再到模板文件本身。
More exactly, from Drupal API documentation:
And if you follow the link above, it will list, in order, the entire theme() progression, from process functions to preprocess functions to the template file itself.
您想要影响进程的哪个阶段,为此有两个选项:
执行。
Which stage of process do you want to affect, for this there are two options:
execute.