Hi,
I was hoping someone could help me with a little dilemma I've encountered.
I am trying to split the display of the $content variable across the left sidebar and the center content areas of a site I'm building. I've found lots of info on how to do this when you are looking at a single node using something like... print $node->field_name[0]['value']
But I'm trying to do this split on a views output (Views 3). So there isn't a node to be referenced. Any advice?
Here are the specifics:
I have a view with 3 fields (Nid - not shown in view output, title and image - a cck field). I'm trying to get the titles to list in the left sidebar and the images (field_image_fid) to show in a grid in the center content area. Now I currently can do this by creating two views displays and then placing them in mini-panels and putting them where I'd like them. But what happens then is that if you hover over an image, the title doesn't react at all. I am thinking that if I split the $content they will both respond when the mouse is hovered (with proper css in place).
Am I correct in that thinking?
And if so, how do I split the fields across different regions of the site?
Or is there another way to achieve what I'm trying to do? I was trying to think about a javascript workaround but I couldn't come up with anything.
Thanks in advance!
Comments
Your current approach is more
Your current approach is more doable than trying to split $content. (Even with a single view, the title will not react to hovering over the image). Using two views my first thought would be custom views templates for both views at the row level so each row includes a class that reflects the node (for example node234), otherwise it would be hard to programatically associate the two. Then I would add custom javascript to get the effect you want.
That sounds great except that
That sounds great except that then I would have to constantly be updating my css file any time I added a new node. Or is there a way to do it with javascript? Or css for that matter but with a variable?
It would have to be a css setting for the class: name_of_class+variable
Then the two would elements would have the same class because of the Nid injection in views.
Is that possible?
My first approach would be to
My first approach would be to override of the the view template (the one above the row template) and add the needed class there.
I think I'm a little
I think I'm a little confused. I can add the class to each element with their associated Nid easily inside Views. I have it outputing currently with matching classes on each of the matching elements. But then it still needs to be referenced by some css to tell it what to do with that class. Are you saying to put the styling directly into the template?
Once you have the classes I
Once you have the classes I would use javascript to apply the effects you want.
Great. I don't do much
Great.
I don't do much javascript. Could you point me in a direction to get syntax for this type of thing? Or give me any pointers?
Much appreciated.