[support] Passing a whole PathAuto category path into a View URL

Ronald Ashri ronald at istos.it
Sat Apr 12 18:07:03 UTC 2008


Hi Neil,

not sure if you can do that just through the settings without any  
code. I have had a very similar problem for the italymag.co.uk website  
and what I did was first create a View with all the settings (fields,  
filters, etc) minus arguments.

Then in the template files I have the following code:

$localnews = views_get_view('local_news');
$localnews_args = array(0 => $context->tid);	
$view_output = views_build_view('embed', $localnews, $localnews_args,  
true, 10);

local_news is the view I created that arranges stories for me, then I  
pass to the view the tid for which I want it to filter the stories and  
output that to the page.

I am not sure it is the most efficient way of doing things but it  
works and it allows me to easily introduce  (if required) more  
arguments and/or more logic based on the term ID.

Hope this helps.

best,

ronald



Ronald Ashri
internet application development
www.istos.it
twitter: ronald_ashri




On Apr 12, 2008, at 6:40 PM, Neil: esl-lounge.com wrote:
> This is quite a complicated one.
>
> I have a Vocabulary, "Location". It is 4 levels deep. (country >  
> state > county > town). I have attached it to three content types:  
> page, story, blog.
>
> I have used PathAuto on the category paths to dynamically alter the  
> URLs to this pattern:
>
> article/[catpath-raw], which gives me URLs such as:
>
> article/united-states/texas/kent-county/jayton
>
> I attached one each of the Page, Story and Blog content types to  
> this town and I go there and get a listing of 3 nodes. Perfect.
>
> Now, what I want to do is to create a View to be able to go to:
>
> article/united-states/texas/kent-county/jayton/blog to see ONLY the  
> blog entries
> article/united-states/texas/kent-county/jayton/page to see ONLY the  
> page entries, and so on
>
> ultimately, I would like to go to article/united-states/texas/kent- 
> county/jayton/page/1 to see on UID 1's page entries for that city.  
> But one step at a time... :-)
>
> The problem: how do I pass all of that cat path to the Views URL?
>
> I set up a View with first argument as "term name" and second  
> argument as "node:type" and I set up the page URL as "article" so if  
> I then go to article/jayton/blog, it works perfectly...However, if I  
> go to article/united-states/texas/kent-county/jayton/blog, I get a  
> Page Not Found as the "term name" is only passing the last part of  
> the overall catpath (i.e. jayton) to Views, not all of it. How can I  
> pass all the catpath into the page URL? Is it even possible to do  
> that?
>
> Thanks in advance.
>
> Neil
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080412/7f111c4c/attachment.htm 


More information about the support mailing list