views:

179

answers:

3

hi,

I'm using Views in Drupal to show node teasers. I would like now to show the complete node on the left side of my page, nearby the Views, and update it when the user click on a different teaser (better using AJAX).

what's the best method to implement it. I was considering to use a lightbox, but it a bit complex (a lot of complications... such as parsing the content with javascript again.. etc).

See screenshot: http://dl.dropbox.com/u/72686/viewsAndNode.png

Thanks

A: 

A quick and dirty approach would be to use an iframe to hold the node content. Users would then be able to switch between nodes without reloading the page, which is I assume your goal. I don't think there is away to achieve what you are trying to do with views out of the box. Have you looked into using panels?

Walden
To clarify, mostly for the OP, you're referring to the panels module (http://drupal.org/project/panels), correct?
intuited
what do u mean for OP ? i actually want a clean solution, because i used ightbox so far, the iframe is terrible, it loads javascript files twice, i cannot parse the content, etc..
Patrick
A: 

Here's what might be a clean way to do it, of course in drupal there's always many ways to accomplish things.

Providing the content for the ajax call

  • Install the services module
  • Setup a service that provides your node as you want it to be displayed

Create the placeholder for your content

  • Install the Panels Module
  • Create a empty fixed width panel to contain the node you want to load
  • Load the view into an adjacent panel

In your controlling view

  • Add a PHP view header and use (drupal_add_js('script.js')) to add a custom js file to the page. or add this to a custom module, or even your theme.
  • Re-Write your view node links to help put the js events together

Setup your javascript events

  • Use add_js to add a custom javascript js file to the page
  • In the custom js add an event to the view links that will poll the services module and load the node into the placeholder panel
openist
If you want to skip the services module there's a tutorial on creating an ajax call back in a custom module here: http://drupal.org/node/42562
openist
A: 

I've solved using the lightbox, and just removing the html code I don't need from the node template with php if the parameter "lightbox=true" is passed with the link.

Patrick

related questions