By yngens on
I really need to display all the nodes submitted by a user on the page which has a path consisting of the website and her username only, like, for instance, http://mysite.com/fenicia.
The problem with views is that they do not accept any arguments immediately after website url, that is I could easily list all the nodes by adding any word or letter before her username like http://mysite.com/ls/fenicia. However, I don't want to put anything between website url and usernames. Any ideas?
Comments
=-=
two methods off top of my head.
create the long url for views, then use viewsalias.module
or embed the view in a node using embed views and url alias the path
Thank you, VM, for
Thank you, VM, for suggestions. I have just tried first method. Unfortunately, viewsalias.module works with specifically taxonomy terms (and I don't want to create taxonomy term per user), seems it does not support aliasing views with paths, consisting of usernames as arguments.
http://drupal.org/project/view_alias says:
Thus I am left with only one choice I believe. Going to try second method.
Just came to my mind, that I
Just came to my mind, that I can't achieve my goal by embedding views within a node. Because, that node also needs some kind of alias itself and I don't want anything between the site's url and usernames. That is url like
http://mysite.com/1st-username has to list all the nodes created by user 1st-username,
http://mysite.com/2nd-username has to list all the nodes created by user 2nd-username,
etc.
So there is no room between 'http://mysite.com/' and 'usernames' for putting node's alias.
I still hope someone can tell me a workaround for this problem.
Well, the node could be put
Well, the node could be put in frontpage. I did that. So I embedded my view in node #40 and have put node/40 in forntpage so that it could be accessed directly at http://mysite.com. After adding username to the url of the site like http://mysite.com/Fenicia, responsible view lists all the nodes of all the users. Unfortunately, a username is not accepted as argument here. Same result at http://mysite.com/node/40/Fenicia
I am afraid embedded views respect actual node path even if put on frontpage.
I even tried to put the
I even tried to put the following code into page.tpl.php to avoid using any nodes:
It correctly displays the view on fronpage, but, unfortunately, does not accept username in the path as 1st argument.
Getting desperate to solve
Getting desperate to solve this. I tried one more failed way.
1. Have all the usernames aliased with pathauto so that they followed directly after Drupal website's base url. That is, you have to take word 'user' (or 'users') which usually goes between the base url and username, so all the 'http://mysite.com/user/username's become 'http://mysites.com/username's.
2. Put this code into 'user-profile.tpl.php'
Now instead of profile page we were supposed to see all the nodes, created by the username in the path (the view does that). But, alas, it does show all the nodes. Again, usernames are not accepted as arguments by views :(