I've actually managed to do half of this already. I have a content type that I use as a profile which included the taxonomy vocabulary "location". Each user chooses a country.
I now have two views called "local content" and "local users". The first shows all content across the site that also shares the same taxonomy term and the second view shows all other users who share that same taxonomy term. Both use default arguments injected into the view by php code (an sql query)
Now I'd like to create a final view where a user who has filled out a profile can see content created by other users who share the same taxonomy term - a sort of hybrid of the two I already have.
I can't see how I could use arguments for this one...it seems more likely I'll have to play around with filters, but how can I use php/sql in filters?
Has anyone else managed to do this type of thing with Views?
Neil
You can probably do something like this using Views relationships.
Here's some videos to get started: http://drewish.com/node/127 http://gotdrupal.com/videos/drupal-views-relationships
On Fri, Nov 19, 2010 at 3:17 PM, Neil Coghlan neil@esl-lounge.com wrote:
I've actually managed to do half of this already. I have a content type that I use as a profile which included the taxonomy vocabulary "location". Each user chooses a country.
I now have two views called "local content" and "local users". The first shows all content across the site that also shares the same taxonomy term and the second view shows all other users who share that same taxonomy term. Both use default arguments injected into the view by php code (an sql query)
Now I'd like to create a final view where a user who has filled out a profile can see content created by other users who share the same taxonomy term - a sort of hybrid of the two I already have.
I can't see how I could use arguments for this one...it seems more likely I'll have to play around with filters, but how can I use php/sql in filters?
Has anyone else managed to do this type of thing with Views?
Neil
[ Drupal support list | http://lists.drupal.org/ ]
how I can write my code for the URL written in JavaScript are from the root of the site and are independent of whether they are clean URL enabled or not?
If y write this
$.get('?q=mycallback', function(data){ })
The code sends this
http://mysite.domain.com/current_url?q=mycallback
I have enabled the Clean URL, if I disable this option, then
If y write this
$.get('/mycallback', function(data){ })
The code sends this
http://mysite.domain.com/mycallaback
some suggest?
Have a look at the Drupal.settings object. Of interest to you is the basePath property.
On 11/22/2010 01:39 PM, Aldo Martinez Selleras wrote:
how I can write my code for the URL written in JavaScript are from the root of the site and are independent of whether they are clean URL enabled or not?
If y write this
$.get('?q=mycallback', function(data){ })
The code sends this
http://mysite.domain.com/current_url?q=mycallback
I have enabled the Clean URL, if I disable this option, then
If y write this
$.get('/mycallback', function(data){ })
The code sends this
http://mysite.domain.com/mycallaback
some suggest?
Yes, i use it by example a found, but
Yes, I used it guided through an example I found online, but my attention, looking at the firebug, when you send a URL that does not use ?q=
so my code now:
$.get( Drupal.settings.basePath + 'current_url', function() {
})
But even the clean url are disabled, the path is
http://mysite.domain.com/mycallback/
why is this?
That Works for me, i just want to understand!
So your ajax call is sending exactly what you tell it to send.
If you send '?q=mycallback' then it sends that, relative to the current URL (e.g., http://mysite.com/some/path/?mycallback).
If you don't include the q= as in '/mycallback' then it sends that-- relative to the current url (e.g., http//mysite.com/some/path/mycallback).
If you want to be safe, then just always send the "q=" version. Drupal understands it, even if clean urls are enabled. If you want your ajax request to respect the site's settings, then send the request without the q=, and test for a valid response. If no valid response then try the non-q= version of the url.
But this seems a little silly, since most users don't monitor ajax requests in firebug as they're browsing the web. Or if they do then I shouldn't imagine they would care whether there's a q= in there or not.
On 11/22/2010 01:53 PM, Christopher M. Jones wrote:
Have a look at the Drupal.settings object. Of interest to you is the basePath property.
On 11/22/2010 01:39 PM, Aldo Martinez Selleras wrote:
how I can write my code for the URL written in JavaScript are from the root of the site and are independent of whether they are clean URL enabled or not?
If y write this
$.get('?q=mycallback', function(data){ })
The code sends this
http://mysite.domain.com/current_url?q=mycallback
I have enabled the Clean URL, if I disable this option, then
If y write this
$.get('/mycallback', function(data){ })
The code sends this
http://mysite.domain.com/mycallaback
some suggest?