By mkahn on
I've written a lil module with the very limited purpose of creating a link to the subdomain /$uri, so that users can switch between subdomains and stay on the same page.
Mysteriously, the link never makes it onto the menu, if I use a subdomain of my domain in the path =>. If i use some other domain, the link appears fine. I've looked at the array output, and its fine. Drupal is filtering out the result somewhere downstream from the rendering of that menu array.
Where is that?, and how do i fix it?
This might be useful for anyone exploring cross subdomain navigation.
Comments
Some questions
There are a few things that I am not sure I understand:
Do you mean a subdomain as in http://sub.example.com? Does /$url mean that site's place in the file system? Or is it about sites with URLs containing a path?
What does it mean to switch between subdomains and stay on the same page? Can you give an example of what the user would do and what should happen if it worked?
There is a lot of security filtering in Drupal (if this is the case here). If you showed some example code someone might know why this array is filtered and how to circumvent the problem.
Sure: this should explain it better-
There is nothing wrong with the code. My print array shows the same array structure from this regardless of what i put into $base. But when $base is my domain, the link stops appearing in my menu.
I got lost reading through menu.inc and bootstrap.inc trying to figure out where its getting filtered out. Its all about what ends up in that path=> statement.
The idea is to go from www.domain.com/currentpage to sfbay.domain.com/currentpage. The link disappears from either part of the if statement when linking to the anything.domain.com. Whereas anything.anyotherdomain.tld works fine.
Mark Kahn,
Droople Apprentice
If you can reproduce this
If you can reproduce this problem on Drupal 6, go ahead and file an issue. The menu system is not really designed to use external URLs for module-created items.
If all else fails:
* Make a local menu item with callback 'drupal_goto' and the dynamic path in the callback arguments.
* Or, make a block that makes the link with l().