By panis on
How can I get my menus to work with two different aliases for the same location...
I have two aliases both pointing to the same resource
path1 -> node/51
path2 -> node/51
I created two menu items one each for path1 and another for path2. I need to do this so that I can display different blocks depending on if the user came via path1 or path2.
However both menu items end up pointing to path1 which is the first alias I created... What are my options?
TIA
Comments
The one of the options is to
The one of the options is to create node, e.g. node/52 with alias path2 that renders node/51 using node_view(node_load(51)) function call
I guess you have put your
I guess you have put your post in the wrong subforum. This one is for actual module development and I don't get the idea that's what it's you about. You might get more replies in the Post installation section for non-module development-related issues.
You have to see this: Drupal works with paths and aliases. Aliases are for nodes, paths for menu items (although the Path module actually provides a way to apply aliases, not paths). Using multiple aliases might be possible, but as far as I know it cannot be done by hand and you'll need to create your own module for that. Using multiple menu items pointing to the same path is not possible, as Drupal doesn't show the duplicates (items are filtered by paths).
It would be possible to have two different paths pointing to the same node, but you either need to make a module that creates two paths and redirects them to the right node or a module that provides two aliases for that same node.
However, I don't recommend either of these solutions. It's not good for SEO (Google the term if you don't know it) and usability, as you've got two pages with slightly different content on them. If you could explain why you would like to achieve this, we might be able to provide you with a more 'solid' solution for your problem.
Internal site so SEO and
Internal site so SEO and search engine not a problem
User can add nodes from their dashboard (homepage) page - and also add nodes while in a common resource page.
The dashboard page and the common resource pages have different menus on the left sidebar driven by the show block on specific paths setting for the block.
This way when the user adds a page through the dashboard page the link is
my/dashboard/add/photo
and when the user adds a page through the resource page the link is
common/add/photo
so while adding the photo node type the user's left sidebar menu is either the dashboard menu or the resource menu depending on where they are adding from.
Right now because the url alias and menu appear to default to the first alias created - when the user clicks on the menu item my/dashboard/add/photo the path jumps to common/add/photo and I lose my dashboard menus.
A practical application
I can provide some insight as to why someone might need to point separate paths to the same node.
In my case, I am preparing to convert my library system's website over to drupal. This library system has 12 branches, and we have information for each location stored in an already-existing database (tied into our calendar system). There is no reason to have 12 duplicate nodes, one for each branch; instead, I've written a single page of code that tests the final part of the URL and uses that information to determine which branch's information to display. This choice means that I can make changes to all of our branch pages with a single code edit, not 12 separate edits.
To get around this limitation in Drupal, I've set up RewriteRules in .htaccess, but it would have been very nice to have been able to manage these aliases in drupal along with all the other aliases.
What did you do in the .htaccess file?
Here's another case of needing the same functionality (linking to the same node from multiple menus). In my case, we have a website for our department at a university. We have a single page for student forms (/current/forms) we also have separate sections of our site for each of our academic departments that each have their own subnav menu (displayed in a block). We need to add a link to the common forms page to each of the departmental menus (/dept1/forms, /dept2/forms, etc.) and not have the menu, path, breadcrumb, etc. change when a student clicks it.
This way we have only one forms page to update, but we need the menu/path to stay depending on how the user gets there.
domesticat,
It sounds like your situation is similar to mine. Can you tell me what you did with your code and .htaccess file to solve the issue?