Posted by mr.alinaki on September 3, 2009 at 8:39pm
Hi!
Is it possible to generate url aliases to nodes by their type without pathauto? I.e. topic/234, forum/456, where topic and forum are some content types? Maybe url_alter may help with that?
Comments
You could use nodeapi
Implement $op 'insert' to create the alias, $op 'delete' to delete the alias, ...
http://api.drupal.org/api/function/hook_nodeapi/6
You could do it dynamically too
http://api.drupal.org/api/function/custom_url_rewrite_inbound/6
http://api.drupal.org/api/function/custom_url_rewrite_outbound/6
I use url_alter to implement
I use url_alter to implement outbound an inbound on my site. But I don't understand, how I can get node type in that functions.
Read url_alter.api.php for details
...and then, you probably need to read the node to know the type it is.
Note that this function is used a lot, so you may want to optimize all you do here.
has to be asked...
Why not Pathauto?
What are you trying to do? custom_url_rewrite_* and url_alter and hook_menu_alter all may be important/useful toward the goal depending on what you are doing.
knaddison blog | Morris Animal Foundation
Im also wondering this
Were importing and regularly updating 40,000+ nodes and have had to use drush amongst other things to make it perform well. One thing that was disappointing was the massive performance hit from using pathauto, it increased the time it took to import & update by at least 1000%, which is a no go for us.
Did you find some other solution, we have a few ideas but I am curious if you found a good option?
Cheers!
performance problems with pathauto
The performance problem is almost certainly related to tokens. If you figure out which tokens are causing the problems, I'd recommend removing their generation (even if by hacking...).
In Drupal 7 that's no longer a problem due to the on-demand generation of tokens.
knaddison blog | Morris Animal Foundation
Thanks for the tip .. ill see
Thanks for the tip .. ill see if we can figure which tokens are dragging the most.
Thats nice to know about Drupal 7 ... suppose I should give that a whirl sooner than later. Im using pressflow drupal though so I'll be waiting for the 7.x release of that before we switch.
Cheers!