Jump to:
| Project: | Subdomain |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
hi setvik,
it has been days that i've been looking around within this site and out of drupal.org itself. i can't be the only one who's looking for this solution.. but i managed to find tho: http://drupal.org/node/391748 (but there's no answer there)
using subdomain.module, i set it to let each individual user to have their own subdomain. i want all their contents to be within their own url. e.g.
http://username.domain.com/photo
http://username.domain.com/photo/content-title-raw
http://username.domain.com/video
http://username.domain.com/video/content-title-raw
i created a Views page to list user's content-type archives (e.g. path video will list all videos that was submitted by the user of that subdomain). the problem with it is, i can't parse the argument as username is the first string in the URL and arguments may not be used even for the first segment of a path.
i hope that someone are able to guide me on my situation.
thanks!
Comments
#1
I'm trying to do the same thing!
Only manual I have done it. My view has path: user/%/photos
I added an alias (admin/build/path/add): user/1/photos ---> ~username/photos
But, this can't be done for every user!
Anyone?
#2
auris has the right idea, but you can take it a step further and automate the creation of the aliases using the Rules module.
I recently had to do something very similar and it works great, though obviously it would be nice for Views and Subdomain to play nicely by default.
#3
#4
I've just bumped up against this same problem, so is it really wise to close this? Arguably we need this functionality in either Subdomain or views. We shouldn't have to set anything up with Rules, surely.
~%/foo ought to work. Views doesn't complain about the syntax (whereas it does complain about %/foo) and yet Drupal gives a 403 when I go to group.main-domain/foo .
#5
I have used rules to bypass this, but I agree that it should work as you describe.
#6
@auris: we used a
hook_nodeapiin the end to do more or less the same thing on group node update. It's risky, though: I ended up temporarily trashing the whole of the url_alias table! Modularized functionality would be safer.Actually, I think this might be a more fundamental issue than Views or Subdomain can handle. Although Views does let you have a path of "~%/foo" , I think it should object just as it objects to "%/foo". Because if you create your own module and try to register a
hook_menuitem for a path beginning with either '%' or '~%' at the beginning of it, then it doesn't work. I think the first path element of Drupal's paths is important and has to be non-variable: something to do with menu handler/callback pattern matching.Would be great to surface it, though, and work out whether it could be fixed for D7/D8. At the moment it's a bit of a gotcha with Subdomain.
#7
+1 with the same problem. I can't tell my view to run through my subdomain... as i can set the url path only after base url
#8
My wish is that the following would work. The main thing is, it doesn't rely on PathAuto, but on views. This is because many nodes belong to multiple subdomains so can't be hard-coded via PathAuto.
dogs.domain.com --> dogs.domain.com/topics -- listing content where topic is a view that shows nodes with dogs, a taxonomy value selected in the view via an argument passed from the subdomain in the URL
cats.domain.com --> cats.domain.com/topics -- listing content where topics is the same view showing nodes with cats, another taxonomy value selected in the same view via the subdomain in the URL
Some nodes are not necessarily unique to ONE subdomain; they might appear in several, like this:
pets.domain.com --> pets.domain.com/topics -- where pets is all the content assigned taxonomy value pets, or eve better, selected by defining pets as dogs or cats or horses or birds or ...
And, to preserve the illusion of a topic-dedicated site, the subdomain should continue to work when opening nodes from the views
The idea is to treat each subdomain as a site devoted to whatever its topic is.
Currently, I do this differently and not so cleanly, via DNS redirection in my domain zone file (totally external to Drupal or my server):
dogs.domain.com --> www.domain.com/dogs --> www.domain.com/view1?topic=dogs
cats.domain.com --> www.domain.com/cats --> www.domain.com/view1?topic=cats
ETC
(above syntax not quite the real thing, used just to demonstrate basic redirection result)
Trouble is, the user never sees the topic subdomains, because by the time the redirect to views and nodes, the user it back at the main www.domain.com.
Lots of mainstream sites do what I'm seeking, and I can to it in my non-Drupal sites. Is there a way to do this in Drupal?
#9
I also have this issue. How do you use rules to bypass this?
Is there a better way at this time?
#10
I don't know if any better ways have turned up in the last few months but I used rules as follows:
So, for example, I have a rule which goes:
ON event After saving new contentIF Content is a group
DO
Create "news" alias
-> Existing path: node/[node:nid]/1
-> Alias path: [node:subdomain]/news
Create "events" alias
-> Existing path: node/[node:nid]/2
-> Alias path: [node:subdomain]/events
Create "letters" alias
-> Existing path: node/[node:nid]/3
-> Alias path: [node:subdomain]/letters
Then in my view, I set up an argument where the "Action to take if argument is not present" is "Provide default argument" and my default argument is "PHP Code" containing simply
return arg(2);I used numbers for my argument values because my argument type is "Taxonomy: Term ID," so the alias subdomain.example.com/news would make the view grab content with a tid of 1. I presume you could use content type or anything else as an argument value when creating the aliases in your rule.
I also created similar rules to update the aliases when a group node is edited and delete the aliases when a group node is deleted.