Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Jun 2012 at 06:58 UTC
Updated:
15 Jan 2021 at 18:47 UTC
Jump to comment: Most recent
Comments
Comment #1
sasingh commentedToday i ran into the similar problem .I solved this problem doing following :
> For the contextual filter ,choose following settings
>>For section 'WHEN FILTER VALUE IS NOT AVAILABLE' select following :
a)tick 'Provide Default Value'
b)select Type = PHP Code
c) in the input box (opens as soon as Type =PHP Code is selected) write following code :
Please note that View preview may not show you the view result but on actual link on your site you would see the expected results.
Hope this helps.
Comment #2
Zahak commentedThat kind of creates other issues when there really are no values (then it's supposed to show all, without any filters at all). Also, I generally really don't like the idea of being able to store php code that way as that is a huge security risk.
Comment #3
janvonmulert commentedFor anyone else who has this problem, this worked for me:
Comment #4
dawehnerIn general these default value php code can ALWAYS replaced by a custom argument default plugin,
which I guess there are blog posts out there how to write one.
Comment #6
robinvdvleuten commentedFor anyone reading this topic, I released a module for this kind of functionality: https://drupal.org/project/views_contextual_filter_query
Comment #7
dddbbb commented@robinvdvleuten Thanks for the module. Just used it and it works great.
Comment #8
pratip.ghosh commented#3 works great... Thanks :D
Comment #9
cvillian098 commentedHelped alot thanks
Comment #10
lunk rat commentedFYI views in D8 core provides this out of the box.