开发者

OR in view's argument -- How to rewrite views query?

I need an OR clause in the arguments section of a view. So if a user passes 123, I'd like to return ro开发者_开发技巧ws WHERE Field1 = 123 OR Field2 = 123.

I'm fairly certain this can't be done in the views interface (but please correct me if I'm wrong).

So I'm trying to rewrite the query. Where's the best place to do this?

I'm in hook_views_pre_execute(&$view) right now, but it looks like this would mean using text replacement on the final SQL string!

Is there a cleaner way to do this?


You could try the Views Or module, or consider this other post.


I've answered a similar question here

Basically you can use either views_or module or hook_views_query_alter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜