Hi evryone,

My problem si that i made a views listing a few fields, when i try to print it into my node.tpl.php using the module_invoke function OR the embed views display module, all the rows show up except the one related to the node im viewing, the problem is that my final goal is to print a couple of fields related to the current node using contextual filters.

note that evrything works fine if i put it into my side collumn region ...

Comments

drupal_napoleon’s picture

Check the filter criteria and/or contextual filters. You may have added something there inadvertently especially if you have other displays associated with the same view.

crawazaky’s picture

Well, i made a dedicated view for this display and i don't think that i added something more than the default. don't forget that my views work as a block in a region but not trough module_invoke.

crawazaky’s picture

a little up, i'm really stuck with this one ...

crawazaky’s picture

one more up please guys.

I really need a solution for this. Either invoke a views' block that works or put a regular regions inside my node.tpl.

WorldFallz’s picture

check the 'offset' option in the pager settings..

crawazaky’s picture

my offset is at '0' ...

The block display well when used in a regular template's region but it won't show the field content when used inside a node.

All i can manage to get is the html code surrounding the content :

 <div class="view-content">
        <div class="views-row views-row-1 views-row-odd views-row-first views-row-last">
      
  <div class="views-field views-field-field-sources">        <div class="field-content"></div>  </div>  </div>
    </div>

the latest code is tried is :

$view = views_get_view('node_fullview_sources');
// set active display on the view
$view->set_display('Block');
// set any needed arguments
$view->set_arguments(array($node->nid));
// execute the view
$view->execute();
// display the results
print $view->render();
Anonymous’s picture

Earlier in the thread you say that you are using the default display of the view, but the last code you uploaded shows that you are trying to load a display named 'Block'. Is this correct?

crawazaky’s picture

Yes, my view is made of a unique block so the default display is "block".

Anonymous’s picture

Without access to your codebase I don't think I could help you any further. It seems from what you've shown that you're doing everything right.

crawazaky’s picture

what kind of info/code do you need ?

Anonymous’s picture

I'd need to be able to look around at all the modules, theme, and configurations, so I'd need both ftp/ssh and Drupal login access. Unfortunately, I don't have time to lend assistance that way right now. I've got a lot on my plate. I wish I could think of something more to add because I know how frustrating these kinds of problems can be.

One thought: do you know for sure that you're getting a valid node id from $node->nid ? If you have devel installed, you can add dsm($node->nid) into your template or you embed code and see what get's printed out.