I've a problem with drupal paths in one view that I building. Right now my view has this form: contents/2/6.
Where 2 and 6 are the Ids of two nodes, I'd like to manipulate these ids to translate them let's say the title of those nodes.
I can not do this from the view because I'm sending these values to a panel, and the panel MUST received the ids of the nodes.
So to sum up, I just want to rewrite (like pathauto does) these ids to title, can I do that? Is there an specific module for this?
Thanks!
If I understand you correctly, you want to keep the original paths 'content/[nid_x]/[nid_y]', but add additional URL aliases for those with more 'speaking' path elements from the nodes (e.g. titles). If that is correct, you have two options:
First, you can do it manually by defining URL aliases for 'content/[nid_x]/[nid_y]' under 'admin/build/path/add'. This is easy to do, but probably not what you are looking for, if you need many of those aliases.
Second, you can do it programmatically by means of the path_set_alias()
function. Using the function is pretty straight forward - the only problem might be where to trigger it. From your description it is not clear to me where/when those views get created, so it's hard to come up with a suggestion - maybe you can edit your question to be a bit more specific on that.
If you want to create that view URL aliases for specific node combinations, you could try to use the 'insert', 'update' and 'delete' operations of hook_nodeapi()
to trigger the alias creation. Obviously, this would only work if there is a coherent rule that would allow you to decide from code for which nodes to create an alias or not.
Once you have an URL alias in place for a certain path, it will be used instead of the original one whenever a link to that path gets created via the l() function. So e.g. if you create a menu entry pointing to 'content/2/6', the used URL would automatically be the alias you created for that path.
Edit: Just in case you end up creating aliases programmatically - If you use pathauto anyways, you could/should use its pathauto_cleanstring()
function (from 'pathauto.inc') to ensure that your generated URLs are properly escaped/rewritten to allowed characters.