Drupal 过滤器无法正常工作
我不知道如何询问,所以如果您需要更多其他信息,请询问!
情况
我有一个三种语言的网站。我在网上收到了很多客户案例,每个案例都与一个部门相关(取决于它们属于哪个部门)。每个扇区和引用都有其自己唯一的nid
。
在我的 template.php
中,它是这样表述的:
if ('sector' == $vars['node']->type) {
$lang = '/'.$vars['language'].'/';
$key_path = $_SERVER['REQUEST_URI'];
$key_path = substr_count($key_path, $lang) ? substr($key_path, strlen($lang)) : $key_path;
if (strpos($key_path, '?')) $key_path = substr_replace($key_path, '', strpos($key_path, '?'));
if (strpos($key_path, 'sectors-references') === 0) {
$view = views_get_view('references');
if (!empty($view)) {
$view->set_arguments((int)$vars['node']->nid);
$vars['content']['suffix'] = $view->render();
}
}
}
然而,每个扇区都向我显示相同的引用...我需要更改什么才能在正确的扇区下获得正确的引用?
I'm not sure how to ask it, so if you need anymore additional information, please ask for it!
Situation
I've got a website in three languages. I got a lot of customer cases online each connected to a sector (depending in which sector they belong). Each sector and reference has it's own unique nid
.
In my template.php
it's stated like this:
if ('sector' == $vars['node']->type) {
$lang = '/'.$vars['language'].'/';
$key_path = $_SERVER['REQUEST_URI'];
$key_path = substr_count($key_path, $lang) ? substr($key_path, strlen($lang)) : $key_path;
if (strpos($key_path, '?')) $key_path = substr_replace($key_path, '', strpos($key_path, '?'));
if (strpos($key_path, 'sectors-references') === 0) {
$view = views_get_view('references');
if (!empty($view)) {
$view->set_arguments((int)$vars['node']->nid);
$vars['content']['suffix'] = $view->render();
}
}
}
And yet, every sector shows me the same references... What do I have to change to get the correct reference under the right sector?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常参数是使用数组传递给
set_arguments
的,如果传递非数组,则参数可能会被忽略,这就是为什么你总是得到相同的结果。尝试:Usually arguments are passed to
set_arguments
using an array, if you pass a non-array the argument will probably be ignored which is why you're always getting the same result. Try: