Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 May 2009 at 15:37 UTC
Updated:
19 Aug 2011 at 09:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mitchell commentedheader/footer/block title/etc
Comment #2
liquidcms commented+1
lots of places tokens would be very handy in Views.. Title seems like an obvious one - and as listed above header, footer, empty text, etc
Comment #3
NecroHill commented+1 It would be cool to have this feature
Comment #4
marcp commentedYep, this would be great. Seems like there must be a workaround for getting tokens into block titles. Anyone?
Comment #5
stefan81 commentedwould love to see this too
Comment #6
dagmarThis feature present some problems.
First, tokens are replaced from each module in special places, and views have a lot of places to make this changes.
Secondly, in order to implement this in a generic way, we should use something like translation plugin, that unpack and translate elements when they are loaded. The problem is, If we replace the token when the view is loaded, which kind of tokens will be available to replace? Only global tokens?
I don't know, maybe it can be only implemented easlily in #510284: Header/footer/empty text and more areas pluggable.
Comment #7
ChrisRut commented+1
:subscribe:
Comment #8
Anonymous (not verified) commented+1 indeed.
Comment #9
boran commented+1
Comment #10
hawkdrupal commented+1111111
This would solve MANY problems and greatly reduce the need for near-duplicate views.
Comment #11
deltab commented+1
Comment #12
stinky commentedSubscribe
Comment #13
kenorb commentedSimilar #673700: tokens in title and header
Some workaround available there.
Comment #14
Guillaume_Desp commentedI think I have the same probleù but not sure...
I need to expose a token in views to filter my results but it doesn't work with views 2.
I can see the value of the token in my viewscacl table but then I can't filter.
Comment #15
wiredescape commentedsubscribe
Comment #16
francewhoa+1 Any volunteer for a patch?
I would be happy to contribute testing and documentation.
Comment #17
meatbag commentedsubscribing
Comment #18
Bilmar commentedSubscribing - I'm needing to use tokens in the title of the views page.
http://www.screencast.com/users/trupal218/folders/Jing/media/8cddb1b1-37...
Thank you
Comment #19
jmseigneur commented+1
Comment #20
dawehnerIn general views builds lists of content, so a single placeholder like [node-title] does not make sense for title/header/footer/empty-text from my perspective. There is the edge-case when you have just a single item displayed.
Comment #21
BeaPower commentedsubb!!!
Comment #22
dagmarLets be honest, as dereine said in #20 and I said in #6, tokens are designed to replace a single instance of items from an object.
Views displays a lots of items of kind of object. So, there is no point to provide [title] as patter of replace, due will be a lot of different titles to replace.
So please, do not subscribe anymore to this issue, at least, provide a "REAL" use case for this feature.
Comment #23
Bilmar commentedHello,
I use views for my event pages and profile pages to show the content for the specific event as well as for differed users. I chose to use views and its template files instead of the node template files as it provides more flexibility in allowing me to use fields from other modules, set visibility settings so depending on the role I have a different display being shown, set filters to only show the page if flagged by a specific administrative flag and show the corresponding empty text, show links to change the event page to show prices and all details specific to individuals or groups done simply by linking to another display etc (the list goes on why views is awesome, hehe) Therefore I have been able to accomplish a dynamic per event and per profile page using views that can be altered depending on who the user is. For this reason I have come to realize that I'm currently unable to set the title of the page using tokens. In my case it would be the event title or user's name that I would like to use (the name wouldn't change no matter the customized version of the page, but still requiring the title to dynamically be set depending on the event title or user's name)
I hope the above use case can help add to the discussion and others can share their usecases as well.
Thank you
Comment #24
hixster commentedo.k. I would like to have a selection of post information listed under each title teaser , the same as it appear on each of my nodes. I am using the http://drupal.org/project/submitted_by module to format the post information on my nodes using tokens, which works great. I would like the same output for my teasers.
I prefer to format my teasers using the field type row style plugin, to have fine grained control as to what appears in them.
So my post info looks like this on nodes:
News Article by admin | September 19 2010 0 comments
To provide the following formatting in views, is a hassle, where as with token's it's a breeze. This is the format i use for 'submitted by'
[term] by [author-name] | [month] [d] [yyyy] [node_comment_count] comments
In views, you'd need to extract the author's name using UID, have a few hidden fields for the date and comment settings. Then to get the top level taxonomy term you need to jump through a few hoops.
Comment #25
gstout commented+1
Comment #26
paul kim consulting commentedHere is a real use case for this feature:
Let's say you have a view that is filtered by a taxonomy term. That means that all the content in this view follows a certain constraint (in this case, a taxonomy term) that is a good candidate for tokenization to use in different places in the view (title, header, footer, "rewrite the output of this field as", etc).
Currently you cannot place such information in the Views title, for instance, without utilizing one of the Views hooks.
Comment #27
webwriter commentedAnother real world use case- I am using Domain Access and would like to append the domain title to the page title to help reinforce to users where they are and to boost the SEO value.
Comment #28
fresheyeball commentedHow about a global token as the value in a filter? Could be very handy.
Comment #29
ergophobe commentedExactly why I was looking for this. I'm using a custom view to handle my taxonomy pages. With a full set of tokens, I could have one view and just slide in [cat] as the title and have at least generally descriptive titles on the View. Currently I set the title to empty.
Comment #30
ergophobe commentedIn this thread:
merlinofchaos mentions a patch for this, but without a link. The best candidate I can find is
#811480: Additional tokens for views
But so far, still failing testing. I couldn't find any others that really address this.
See also #365418: Setting the View-Title programmatically in Views2 for some solutions to the title issue.
Comment #31
giorgio79 commentedUse case:
I am using Page display, and have an exposed filter for a field. Selection is forced, and single selection.
So, for example I have services, and their types are video, search etc.
When the user changes filter, I would like the page title to use that field, eg
Video Services
Search Services
etc
Thanks :)
Comment #32
dawehnerThis issue is about using the token module in views.
@#31
We try hard to clean the issue queue. Your feature request seems to be something like a more valid feature request then tokens support. Please create a new issue for this, it's out of scope here.
The issue would be to allow exposed filter values in other parts of views.
Comment #33
giorgio79 commentedOk thanks :)
#964120: Enable filters to modify page titles
Comment #34
patcon commentedFor those who want a header with tokens, just use an attachment view displayed above your page view, with a display type of Unformatted. Limit the view to one item, and load all the fields you'd want as "tokens". Exclude all the fields from display, then add a "Global: Custom text" field, and insert all the other fields as tokens.
It's pretty much the same thing as a dynamic header, as far as the user in concerned :)
Comment #35
Q2U commentedpatcon, I apologize for my Newbieness, but could you possibly elaborate on youe method? How does one "attachment a view displayed above your page view?" What is an "attachment view."
I am most interested in your method.
Thank you.
Comment #36
patcon commentedSure thing dude.
There are different types of view displays -- block, page, attachment, feed, etc (more can be added by other modules). Each little tab on the left of the a specific view edit page corresponds to one of these view displays. You can add more or remove them, and they all sort of use the "Default" view display as a base (although you can overwrite).
So if you want a dynamic header:
Phewf. Took longer than expected to explain, but hopefully you get the idea. I haven't done this myself, but I can't see why it wouldn't work. If you need to header to disappear when values don't exist, then instead of adding a "Global:Custom text" field, you can leave one field visible and simply override it with tokens and custom text (so that it become the header). That way, you can use the checkbox to "Hide field if empty", and when that field has no value, it will hide the whole header. If that's what you're going for, I think there's also a setting in the "Attachment settings" pane that you'd need to adjust, telling views to hide the attachment if nothing is returned (but maybe I'm mistaken).
Anyhow, hopefully this helps :)
Cheers
Comment #37
Alexander Matveev commentedsub
Comment #38
ezeedub commented@patcon Just wanted to say thanks for the suggestion. This solved a similar problem I was having.
Comment #39
jelo commentedpatcon, thanks for the idea. Solved my problem!
Comment #40
ordually commented@patcon in #36, I wanted to add my 'thanks' to the list...your writeup helped me out!
Comment #41
patcon commentedoh hey, no worries at all folks! Glad it helped :)
Comment #42
nodecode commentedpatcon, this is totally brilliant!
I have a couple observations on theming this to look like normal views headers. WARNING: I'm using a Zen-based theme and I'm utterly illiterate on Drupal theming at the moment, but these are my observations so far...
1. You will need double
<p><p></p></p>tags to emulate the behavior of a "Full HTML" views header which views appears to wrap in<p></p>tags. I say "use double" tags because the first set of<p>tags of a "Global: custom text" field appears to be stripped by views.2. I haven't tried this yet because i haven't themed my site but you may want to add "view-header" to the CSS class: field as well.
Thanks again.
Comment #43
Some Kid commented@patcon from another happy customer :-)
Brilliant!
Thanks.
Comment #44
stinky commentedBetter late than never, @patcon THANKS! Your solution totally was what I needed.
Comment #45
emattias commentedHere's a patch that adds a token for every field which returns [field_name]-empty or [field_name]-not-empty string depening on if the field is empty or not.
I use this to add a "imagefield-empty"/"imagefield-not-empty" as a row class in a list of nodes that may or may not have an image. This patch works for other kinds of fields also. As long as they return something "falsy" when empty(like an empty string) and something "truthy" when not empty.
This is something I've needed on several projects and grew tired of hacking this together. So I hope that this gets commited to views asap.
Comment #46
emattias commentedItangalo came up with probably a cleaner way of getting this functionality. His idea was to build a new views field handler which checks another field if it is empty or not and outputs whatever you want. Then you use this new fields' token.
This way you dont end up with duplicate tokens for every field.
Unfortunately I probably won't have time to make this on my current project.