Posted by bobmct on December 13, 2011 at 7:34pm
For all you Views2 experts - here's one I can't find a way to do but I'm sure it exists.
In a new view I'm creating I am outputting several fields. But one of them is a coded value and it needs to be translated before it is displayed. This would normally require some php manipulation.
I tried adding my code to the "rewrite this field" block but it only displays the code, not the result. So with the level of sophistication the views2 module provides, there must be a method.
Would someone please point me to a method or technique to accomplish this feat?
Thanks all - :-)

Comments
Views Customfield?
Or modify the field in a views template file? For that, in the View, under Basic settings, click on the Themes Information. It will list the styles and fields you can theme. Click on the Field Node link for the field you want. You can use php or rewrite the php in the template.
Thanks Jim. I was just
Thanks Jim. I was just working on the field based tpl.php approach when I received your post.
I've installed views_customfield and now see that I can create one in my fields section of a view. I do have one question for you (or anyone) and that is what data structure is one supposed to reference to obtain data? I thought it was $data->fieldname but I can't seem to get anything. I also tried print_r($data,TRUE) with no output.
And, what I am trying to access is a taxonomy term to see if it contains a string. Here is the generated SQL from a working view:
(UPPER(term_data.name) LIKE UPPER('%UCLW%'))
Is there a way within views using customfield to output a hidden value indicating if this test was true or not?
Here's my specs:
A view displays content on a page. The content contains a single content type. But a field in that content can contain strings to indicate certain classifications. When the user seeing that display clicks on the title of one of those items displayed I need to trigger one of two slightly different views depending on whether the selected item contained that taxonomy string or not. I was also thinking that maybe it could be accomplished with conditional "pages" within the same view. I'm just a long way from fully understanding the new views implementation. If it was a non-CMS site, a couple of lines of PHP to generate some hidden html and voila! Just not that simple.
If my custom field could make that determination and set a variable, then I could "print" that variable surrounded by a with a class of "display:none" which would render it physically on the screen and accessible by programming but NOT actually displayed or taking up real estate.
Any ideas, suggestions greatly appreciated.
Bob :-)