By rodrigo.heffner on
Hi all!
I have this piece of code:
views_create_view('$typed_term','');
views_view_add_page($view, '@typed_term', 'view/'.$typed_term, oaliquid_list, true, 10, 1, false);
views_view_add_filter($view, '','term_node1.tid','AND', $nid, '');
views_load_cache();
views_sanitize_view($view);
views_build_view('page', $view, array(), false);
And I believe that this would create a view for me wherever I put it (if the variables are correct).
I want to make this code run everytime a taxonomy is added. Anyone knows where should I put it? I know it must be somewhere in taxonomy.module file, but where's the best place to do that?
Thanks for everything!!
Comments
oo... don't edit the
oo... don't edit the taxonomy.module
that is considered a "bad idea"
http://drupal.org/node/144376
can you describe in a little more detail what it is you're trying to do? (maybe you have a mock-up or something?) i think i can help you, without you needing to edit the taxonomy.module.
Thanks for the tip!! I have
Thanks for the tip!!
I have some taxonomies (like vehicles -> SUV -> Ford -> some_vehicle), and each time I create a taxonomy like Ford in this example (a taxonomy that has children) I'd like to create a view that would show it's children.
I'm in a reeeeeeeeeeeeeally big hurry!!!
Thank you so much for the help, heather! Hope to hear from you soon!!
OK... I'm sorry I'm super
OK... I'm sorry I'm super busy in work today, so i can't map out a detailed example (maybe someone else can chime in, or if you're really pressed for time, hop on IRC, the live chat channel- #drupal-support)
1) You'll be making a view that pulls in an argument, in this case the term.
2) The argument will tell it how to filter the nodes to just show taxonomy term's children.
However, now that I understand your situation better, I think you may find a module that can help you.
See these listed here, in a search:
http://drupalmodules.com/search/node/taxonomy+view
Like this: http://drupalmodules.com/module/refine-by-taxonomy
Mind you, if you're pressed for time, make sure you start a TEST site. It seems to take extra time to set up but you won't be devastated if anything happens. And you will save time in the future.
-------------------------------------------------------------------------
- Follow Best Practices, it is the road to happiness
- Tips on Giving effective feedback in the forums
Thank you so much, heather!
Thank you so much, heather! You're the nicest person ever!
I'm pressed for time, but I'll do a demo for people inside my company. They'll understand any minor error.
This module "REFINE BY TAXONOMY" may help me.
I'm developing a website that has classified ads, and new terms will have to be created, so I was thinking about an "automatic" way to make this process of creating a taxonomy, then a view with the same name of the taxonomy which will display all items of that taxonomy.
I'll try the module you suggested me and I'll install IRC here and enter the channel you pointed me.
Thank you so much for being interested in my problem! I'll try to update you soon!
I've tried to join a random
I've tried to join a random server in Freenode , but an error of invalid username is returned. I can loggin to other servers, but not to this one. I'll keep trying to enter your drupal channel.
My website is
My website is http://sandp.vunje.com.br .
If you click on "vehicles", it will display some categories.
If you put your mouse over Audi, for example, you'll be able to see (in your browser) that you'll be pointed to a view if you click on it.
The problem is: I have to create a view to each category (Audi, Chevrolet, Mercedes, Fiat). In the near future, I'll have hundreds of these categories, and I don't want to have to add a view to each one in views module. I want them to be "created" (or at least be displayed) when I click directly on the link (Audi, Fiat...).
Some people have told me to "expose the filters", but I guess that by doing that, I can only point to other existing views (I cannot create new ones this way).
Thanks for the help!!
Here's some advice about the
Here's some advice about the IRC channels.
how to join:
http://drupal.org/node/32405
tips:
http://drupal.org/irc
Did you try expose filters? It lets you sort live. There would be a pull-down menu for taxonomy type when you view your "view" this is perfect. You don't have to pass arguments or anything.
Did you try it yet?
That is exactly a god solution for you, and it never occurred to me :)
I exposed the filter and, by
I exposed the filter and, by code (far from core modules), I could manage the view by changing the TID in the url. This pratically solves my problem, but 2 things are not perfect, still:
- The name of the view is static. I wish I could change it in the url OR set it somehow to match the taxonomy term.
- The view actually exposes the filters. I wish I could manage the url without showing the exposed filter on screen (box with taxonomies and another one with "is one of", "is all of"... and the button submit).
Any tips?
Ah okey- I see. The exposed
Ah okey- I see. The exposed filter does not suit your needs.
Have you tried setting up an argument to pass a query to your view?
What I mean is, the view might be at a path like:
blahblah.com/showme
- then you set up an argument to pass the taxonomy term...
so the URL looks ike blahblah.com/showme/shoes ... etc.
Have you tried setting up Arguments before? Try a test page view, and set up an argument, and test it by typing in the path of the view, adding the argument to pass...
I'm not making much sense... hmm..
Please try a tutorial to first learn how to use arguments. Then adapt it to suit you. You might want to google for one with video... I thought these were helpful examples to try though:
http://drupal.org/node/206845
Thank you so much, heather!
Thank you so much, heather! The arguments worked fine for me!
Thank you for your help!!