Hello all.

I'm using your module and it's working fine, great work. But I'll need a different header (title or whatever you want to trigger the accordion). I was thinking in a header where you have not one but all the fields you want (like a table row) and when you click in a selected field (e.g. node title) or in a button, then expand the body of the view...

I don't know you can understand me, so here is a link where are the functionality I want to my page:

http://www.tastebook.com/search?query=arroz&x=0&y=0

You click in a recipe title and then all expands, but in the row, you have like a table with more fields...

If this module it's not ready for this functionality, do you know about any module which I can make this work?

Thanks a lot.

Carlos.

CommentFileSizeAuthor
#15 severalfieldsasheaders.jpg83.94 KBmanuel garcia

Comments

escuriola’s picture

Title: eader as » Table and accordion
manuel garcia’s picture

Title: Table and accordion » Choose several fields as the accordion header
Status: Active » Postponed

Hi elesku, thanks for the request :)

First, this module doesn't use tables, and will never use tables.

Second, what you need would imply a major rewrite of how the content is being rendered, and of the module as a whole, so I don't think this will be happening any time soon... sorry!

Third, I do see the benefit of using several fields as the header, so I'll look into it when I get some time, but I don't think it'll be anytime soon, as it'd require quite some work/research.

Finally, I don't know of any module that would get you that specific functionality, but you could write some jquery and some custom tpl for your view, and get the result you want, that's for sure.

manuel garcia’s picture

Title: Choose several fields as the accordion header » Use several fields as the accordion header
Category: feature » support
Status: Postponed » Fixed

Actualy elesku, after doing some research, as of Views 2.3 all fields have a checkbox to rewrite the output of the field, and you can use the results of several fields together.

So this means you can do what you want already. Click on the field you want to, and check "Rewrite the output of this field" ... it will open a whole settings section for you, in there you can use the "Replacement patterns" which will allow you to use previously listed fields within that field. It also allows you to use html in there so it's great. Then just check exclude from display on the fields before that, since you are including them in that field already, and voila, you got what you need.

In doing so, I noticed that if you have previously excluded fields, the accordion wont work. So I made some changes that will work with such settings on, and have already committed the fix to CVS. If you are in a hurry you can grab the new files from there, or you can just wait for the script to run and grab the latest dev version of this module when it comes up later on. You will need these changes if you plan on doing what you explain above, since you dont want to show fields twice.

So we found out about a bug in the process, which is squashed already, that's good :) Also, got to respect the maintainers of views.. which is an amazing module!

Hope it works for you, let us know how it goes.

escuriola’s picture

Gracias Manuel, tu sí que vales!! People like you are the reason I'm using Drupal in all my projects.

I'm making just now the changes you comment and as soon as everything works, I will return to tell you the experience. I think I have to do some extra html, as you said. I'm tableless friend, but I think in this case I'm going to use because I'm displaying tabulated information.

I will tell you all my experience and I found any issue or I think there is a possible new feature, I will report.

Thanks again for you help.

escuriola’s picture

First problem I found: I have limited the number of character in the "Rewrite the output of this field" and a cannot full with all the code I need. So I found this field really short to me... One solution will be using a prefix and a sufix in order to create something similar to this:

Prefix:

<table><thead><th>Inmueble</th><th>Habitaciones</th><th>M2</th><th>Precio</th></thead><tbody>

Rewrite the output:

<tr><td>[title]</td><td>[field_inm_habitaciones_value]</td><td>[field_inm_metros_value]</td><td>[field_inm_precio_value]</td></tr>

Footer:

</tbody></table>

Similar that the form markup module does.

I'm looking for an alternative code but with this limited number of characters I cannot do so much...

Any ideas?

manuel garcia’s picture

I suggest you use a template file for the value of that field you are working with elesku. That way you can wrap what you put in there<tr><td>[title]</td><td>[field_inm_habitaciones_value]</td><td>[field_inm_metros_value]</td><td>[field_inm_precio_value]</td></tr> with your prefix and sufix markup. While you are at it, wrap the strings in t() ;)

I think like this you'd get what you want.

escuriola’s picture

Great! Thanks for the idea. I'm trying to do modifying the views template (views-view-accordion.tpl.php and other), I think that with this I can do what I have in my head.

Thanks again!!

escuriola’s picture

It's seems is a bit difficult... When I display something, another part breaks... I get something, not exactly what I want but for now is fine. This weekend I will try again...

manuel garcia’s picture

If you modify views-view-accordion.tpl.php in your theme, you'll be modifying each and every accordion you ever have in that theme, this is probably not what you want... I suggest you click on the Theme information link in the config for your view, and use a template file suggested there for the field you are using to output the combination of fields, for that specific view display.

This way you only affect that field output, within that view, within that display. Unless of course you are using several displays with this technique, but well, you get the idea i hope :)

Also keep in mind that views template files override the cck fields template files, as far as I know.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ñull’s picture

Status: Closed (fixed) » Active

I want 3 fields to appear in the header. An image_cache product image, title and price (I'm using Ubercart). I combine the three in one field, the price field with the above method, but they don't appear in the header, only the price. I excluded the combined fields from displaying to avoid duplication, but still the price they appear when I click to open the accordion. How to proceed?

ñull’s picture

Version: 6.x-1.x-dev » 6.x-1.2-beta3

Beta3 seems at the moment to be the latest so that is what I was using

manuel garcia’s picture

Views accordion respects the settings on the fields for excluding, and i have tested the method explained above (which is a views2 method, nothing to do with accordion), it works and should work on your case....

I asume you are combining the fields above right? did you clear the cache also? otherwise, can you provide a screenshot of the settings perhaps? is your site online to be checked?

ñull’s picture

In my case to combine these 3 fields I have to do it in the third, the price field, because in the first the fields are not available. Your module however doesn't permit to be triggered on the third field, only in combination with grouping. So when I do grouping on the price field that combines the image title and price, then I don't see image nor the title in the header (may be because in grouping it doesn't know which one to choose?) and it will group together the products of the same price, which is an undesired effect. May be you could add the feature that the trigger field can be be chosen independently of the grouping? As I understand the image and title simply don't appear because they cannot be unique when you group.

manuel garcia’s picture

StatusFileSize
new83.94 KB

Grouping is not meant to do what you are after here com2, it is for grouping results by a field, not group fields to display together.

Views accordion will use the first field in the list, that is not excluded as the header for the accordions.

So use the above method for displaying several fields inside one, and set the ones above to be excluded from the display. It should give you what you want. I have tested it localy, and it works fine.

See the attached screenshot to see how to do it:

ñull’s picture

I managed it here as well. In fact I discovered it by looking at the code. I include here some instructions for others or for documentation.

Say you want three fields in the header. They need the be first in field order and the third needs to be the combination of the first three by rewriting the output of it. To make the third field the trigger field you will need to exclude from display the first two fields. There is no problem with that since they appear in the header anyhow.

manuel garcia’s picture

Status: Active » Fixed

By the way, this was documented earlier in this thread... hopefully now with the screenshot people won't reopen this again.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.