PHP hook_views_query_alter Drupal 6.x(substring)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP hook_views_query_alter Drupal 6.x(substring)相关的知识,希望对你有一定的参考价值。
/**
* Implementation of hook_views_query_alter().
*/
function local_views_query_alter(&$view, &$query) {
if ($view->name == 'our_partners' && $view->current_display == 'page_1') {
//alter the query so we actually select the results with the surname begining with the arg
$query->where[0]['clauses'][3] = "SUBSTR(reverse(node.title), locate(' ', reverse(node.title)) - 1, 1) = '%s'";
}
if($view->name == 'our_people' && $view->current_display == 'page_1') {
//alter the query so we actually select the results with the surname begining with the arg
$query->where[0]['clauses'][2] = "SUBSTR(reverse(node.title), locate(' ', reverse(node.title)) - 1, 1) = '%s'";
}
if($view->name == 'our_people' && $view->current_display == 'attachment_1') {
//alter the query so we actually select the results with the surname begining with the arg
$query->fields['title_truncated']['field'] = "SUBSTRING( reverse( TRIM( node.title ) ) , locate( ' ', reverse( TRIM( node.title ) ) ) -1, 1 )";
}
if($view->name == 'our_partners' && $view->current_display == 'attachment_1') {
//alter the query so we actually select the results with the surname begining with the arg
$query->fields['title_truncated']['field'] = "SUBSTRING( reverse( TRIM( node.title ) ) , locate( ' ', reverse( TRIM( node.title ) ) ) -1, 1 )";
}
}
以上是关于PHP hook_views_query_alter Drupal 6.x(substring)的主要内容,如果未能解决你的问题,请参考以下文章
Drupal 视图过滤器中的 OR 运算符
linux 安装多个PHP版本(php5.6 php7.1 php7.2 php7.3 php7.4 php8.0)nginx配置php多版本
php [guzzle php] guzzle php #php
php send.php php邮件模板#php
IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?
如何从php5升级到php7