Posted by timmillwood on October 31, 2008 at 11:35am
I am looking to create a view where the view items link to a url created from a view.
eg.
I want to list all users blogs from their "Blog title" profile field, then link this to their blog "http://www.domain.com/username".
I want going to put code in a block, or a module to do this, but then I thought, Views should be able to do this!

Comments
Yes, this is straight
Yes, this is straight forward using Views. Create a view which includes the user name as a column, then theme that column so it is a link to their profile. I've done this on http://www.pedagogle.com.
Dave
If i have to fiddle it in
If i have to fiddle it in the theme i might as well write a block to do it.
No fiddling necessary
Use Computed Field: http://drupal.org/project/computed_field
Cheers,
Bill
FunnyMonkey
Tools for Teachers
FunnyMonkey
I did end up themeing the
I did end up themeing the view, thanks.
http://blog.to.it
Is there an example for
Is there an example for something like this? I think a lot of people would be interested in something similar, and, if this is in the docs it would help a lot of people.
All the information is in
All the information is in the views documentation http://views-help.doc.logrus.com/help/views/analyze-theme
The way I did it was, output the username and the profile field and Views fields, setup a theme for the username field which was something like
<a href="<?php echo $content; ?>">and setup a theme for the profile field which was something like
<?php echo $content; ?></a>I don't think this is the best way to do it, because I am getting a very ugly output, but it works for now.
The output is
<div id="block-views-new_users-block_1" class="block block-views even sidebar">
<h3 class="title">Newest blogs</h3>
<div class="content">
<div class="view view-new-users view-id-new_users view-display-id-block_1 view-dom-id-2">
<div class="views-admin-links views-hide">
<ul class="links"><li class="0 first"><a href="/admin/build/views/edit/new_users?destination=posts%2Fall%2Ftop#views-tab-block_1">Edit</a></li>
<li class="1"><a href="/admin/build/views/export/new_users">Export</a></li>
<li class="2 last"><a href="/admin/build/views/clone/new_users">Clone</a></li>
</ul> </div>
<div class="view-content">
<div class="views-row-1 views-row-odd views-row-first">
<div class="views-field-name">
<span class="field-content"><a href="/apollomemories/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">McArthur's Rant</a></span>
</div>
</div>
<div class="views-row-2 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/paleologo/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Contagious Interior Design</a></span>
</div>
</div>
<div class="views-row-3 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/chalky/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Chalky</a></span>
</div>
</div>
<div class="views-row-4 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/rubberjonny/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Rubber Jonny</a></span>
</div>
</div>
<div class="views-row-5 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/Lankygit/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Lankygit</a></span>
</div>
</div>
<div class="views-row-6 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/Jason-Edge/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Design Agency Blog</a></span>
</div>
</div>
<div class="views-row-7 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/Samer/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Nobody Knows Me</a></span>
</div>
</div>
<div class="views-row-8 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/steveAirCav/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Sirius Cybernetics Corporation</a></span>
</div>
</div>
<div class="views-row-9 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/cardiffliving/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Cardiff Living</a></span>
</div>
</div>
<div class="views-row-10 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/paulstamatiou/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Paul Stamatiou</a></span>
</div>
</div>
<div class="views-row-11 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/engadget/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Engadget</a></span>
</div>
</div>
<div class="views-row-12 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/macrumors/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Mac Rumors</a></span>
</div>
</div>
<div class="views-row-13 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/walkah/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">walkah</a></span>
</div>
</div>
<div class="views-row-14 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/techcrunch/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">TechCrunch</a></span>
</div>
</div>
<div class="views-row-15 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/wmostrey/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Drupal planet</a></span>
</div>
</div>
<div class="views-row-16 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/robin/">
</span>
</div>
<div class="views-field-value">
<span class="field-content"></a></span>
</div>
</div>
<div class="views-row-17 views-row-odd">
<div class="views-field-name">
<span class="field-content"><a href="/mansfielduk/">
</span>
</div>
<div class="views-field-value">
<span class="field-content"></a></span>
</div>
</div>
<div class="views-row-18 views-row-even">
<div class="views-field-name">
<span class="field-content"><a href="/timmillwood/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Millwood Online</a></span>
</div>
</div>
<div class="views-row-19 views-row-odd views-row-last">
<div class="views-field-name">
<span class="field-content"><a href="/blogtoit/">
</span>
</div>
<div class="views-field-value">
<span class="field-content">Blog to it blog</a></span>
</div>
</div>
</div>
adding a link to a view.
I am a complete newbie. I have a content-type form with a unique id and a view that has three fields from the content. One of the fields is a hidden field for the unique id in the content. The view lists all the contents showing title. I would like to have the user be able to click on the title field and be sent to the content with the id that matches the id in the view. how can i do such thing?
thanks.
It sounds like you're trying
It sounds like you're trying to make a link from the field to the node it's part of. There's a checkbox for this if you look in the settings for the field (by clicking on the field name in the views editing page). It'll be marked "Link this field to its node" or "Link this field to the original piece of content". If I've misunderstood the question, then you can probably achieve the results you are after by using the "Rewrite the output of this field", also accessible in the field settings.
"Rewrite the output of this field"
Well, i am not sure if you misunderstood me or if i was unclear. But i was using the Rewrite the output of this field. However a co-worker just informed me that we no longer use that feature instead use the title which has a feature to link to the original document.
I am checking into that. What i want is to have one field in the view to be able to link to the document with the same id.
Thanks for the reply.
Rewrite the output of this field
Link this field to the original piece of content is in the title field, but i have to use another field instead. I tried the rewrite the output of this field, but the problem i am having is to link that field to the correct url for the content-type. In the Link path i have included the url to to the root: http://blablah.com/content/. But now i need to add the link to the document itself. How can i handle that?
Thanks
Rewrite the output of this field
Ok try this:
1) Go into the "Fields" section, add a new field and choose "Content: Path". In the properties, click on "exclude from display" so it doesn't show up in the results
2) Choose "Rearrange" from the Fields section dropdown and re-order the fields so that "Content: Path" is above the field that you want to rewrite as a link
3) Edit the properties of the field you want to rewrite as a link and check "Output this field as a link". If you scroll down in this section you will see an area marked "Replacement Patterns". You should now see that the replacement pattern "[path]" is now available. If you put "[path]" (without the quotes) in the "Link Path" field, you should achieve the result you are after.
Rewrite the output of this field
That did it. Thank you very much.
Thanks!
Thanks so much for this response patchrobe, helped me as well!
it doesn't work for multiple
it doesn't work for multiple items. If rewrite as a link is enables, each items are replaced by first .