如何将多个参数传递给views_embed_view?
我的 .module 文件中有一个表单。在表单提交按钮中,我使用views_embed_view函数嵌入我的视图。我想将多个参数传递给视图。 这是我的代码
<代码> 打印views_embed_view('testing_signup_info', '默认', '1,2,3');
上面的代码工作正常,三个参数传递给视图,但我想从signup_log表中获取sid并将它们作为参数传递给视图。 这是我的代码。
<代码> $result = db_query("从signup_log中选择sid");
$rows = array();
while($row = db_fetch_array($result)) {
$r = $row['sid'];
$rows[$r] = $row['sid'];
drupal_set_message($r);
}
drupal_set_message(views_embed_view('testing_signup_info', 'default', '"' . $rows .'"'));
但这里我的视图没有显示。 如果有人知道解决方案,我需要帮助。 如何传递从表中检索的 sids 并将其作为参数传递给视图???
I have a form in .module file. In the form submit button I am embedding my view using views_embed_view function. I want to pass multiple arguments to the view.
Here is my code
print views_embed_view('testing_signup_info', 'default', '1,2,3');
The above code works fine and three arguments are passed to the view but i want to get sid from signup_log table and pass them as the arguments to the view.
Here is my code.
$result = db_query("SELECT sid from signup_log");
$rows = array();
while($row = db_fetch_array($result)) {
$r = $row['sid'];
$rows[$r] = $row['sid'];
drupal_set_message($r);
}
drupal_set_message(views_embed_view('testing_signup_info', 'default', '"' . $rows .'"'));
but here my view does not display.
I need help if someone know the solution.
How to pass sids retrieving from the table and pass as arguments to the view???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您包含的代码片段似乎传递了一个数组。根据我对merlinofchaos的评论(Views的作者)的理解, Views 看起来不像需要传入数组。请尝试以下操作:
The snippet you included appears to pass in an array. Based on my understanding from this comment by merlinofchaos (the author of Views), it doesn't look like Views expects an array to be passed in. Try the following instead: